当前位置:网站首页>The difference between MVVM and MVC
The difference between MVVM and MVC
2022-07-05 22:04:00 【Yang Yang Yang Yang Yang Yang Yang Yang Yang Yang Yang Yang Yan】
mvvm
Concept :MVVM
yes Model-View-ViewModel
Abbreviation , Corresponding to : data , View , Model view .Model It's the data model in our application ,View It is our UI View layer , adopt ViewModle, We can Modle The data in is mapped to View On view , meanwhile , stay View Layer modified some data , It will also reflect and update our Modle. The simple understanding is Two way data binding
, That is, when the data changes , The view changes , When the view changes , The data will also change synchronously .
With vue For example :view
Corresponding template
,vm
Corresponding new Vue({…}),model
Corresponding data
1 . view View layer
<p>Hello, {
{ name }}!</p> --View layer --VUE One way binding in
<input v-model="name"> --View layer --VUE Two way binding in
123
···
2 . model The data layer
```js
data: {
name: '' --Model layer
}
123
3 .VM layer
VUE The frame is encapsulated
new Vue({
…})
12
The relationship among the three :
view You can bind through events ( or v-model Instructions ) How to influence model,model Can affect... In the form of data binding view,viewModel It's a model and view Connected connectors
MVC Pattern summary ( Typical frameworks are angular.js)
1 . namely Model、View、Controller
namely Data model 、 View 、 controller
.
View: View layer ;
Model: Business data layer ;
Controller: controller . receive View Instructions passed from the layer , selection Model Data corresponding to layer , Carry out the corresponding operation .
2. Take a similar example in reality ,MVC Like the operation mode of a shop ,View The floor is equivalent to the storefront of this shop ,Model The floor is equivalent to the warehouse of this shop ,Controller The floor is equivalent to the executive department of this shop .
characteristic :MVC There are two modes , Either way ,MVC All communications are one-way , It can also be seen from the figure ,View The layer will be from Model Take the data , therefore MVC Medium View Layer and the Model There is still coupling between layers .
边栏推荐
- Basic grammar of interview (Part 1)
- Evolution of large website architecture and knowledge system
- 【愚公系列】2022年7月 Go教学课程 003-IDE的安装和基本使用
- 如何開發引入小程序插件
- 每日刷题记录 (十四)
- Summary of concurrency control
- Hysbz 2243 staining (tree chain splitting)
- 装饰器学习01
- 阿龙的感悟
- MySQL disconnection reports an error MySQL ldb_ exceptions. OperationalError 4031, The client was disconnected by the server
猜你喜欢
科技云报道荣膺全球云计算大会“云鼎奖”2013-2022十周年特别贡献奖
Summarize the reasons for 2XX, 3xx, 4xx, 5xx status codes
Getting started with microservices (resttemplate, Eureka, Nacos, feign, gateway)
Leetcode simple question check whether all characters appear the same number of times
Business learning of mall commodity module
极狐公司官方澄清声明
Granularity of blocking of concurrency control
Analysis and test of ModbusRTU communication protocol
Daily question brushing record (XIV)
Implementing Lmax disruptor queue from scratch (IV) principle analysis of multithreaded producer multiproducersequencer
随机推荐
Did you brush the real title of the blue bridge cup over the years? Come here and teach you to counter attack!
Stored procedures and stored functions
Overview of database recovery
The American Championship is about to start. Are you ready?
微服务链路风险分析
每日刷题记录 (十四)
Blocking of concurrency control
SecureCRT使用提示
Comment développer un plug - in d'applet
ICMP introduction
如何開發引入小程序插件
Evolution of large website architecture and knowledge system
Countdown to 92 days, the strategy for the provincial preparation of the Blue Bridge Cup is coming~
Experienced inductance manufacturers tell you what makes the inductance noisy. Inductance noise is a common inductance fault. If the used inductance makes noise, you don't have to worry. You just need
K210学习笔记(四) K210同时运行多个模型
Analysis and test of ModbusRTU communication protocol
从零开始实现lmax-Disruptor队列(四)多线程生产者MultiProducerSequencer原理解析
How to develop and introduce applet plug-ins
Leetcode simple question: check whether each row and column contain all integers
数据泄露怎么办?'华生·K'7招消灭安全威胁