当前位置:网站首页>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 .
边栏推荐
- Getting started with microservices (resttemplate, Eureka, Nacos, feign, gateway)
- 从零开始实现lmax-Disruptor队列(四)多线程生产者MultiProducerSequencer原理解析
- Regular expressions and re Libraries
- "Chris Richardson microservices series" uses API gateway to build microservices
- K210 learning notes (IV) k210 runs multiple models at the same time
- AD637使用筆記
- Matlab | app designer · I used Matlab to make a real-time editor of latex formula
- Analysis and test of ModbusRTU communication protocol
- Blocking protocol for concurrency control
- Evolution of large website architecture and knowledge system
猜你喜欢
CA certificate trampled pit
Ad637 notes d'utilisation
Two stage locking protocol for concurrency control
科技云报道:算力网络,还需跨越几道坎?
Database tuning solution
数据泄露怎么办?'华生·K'7招消灭安全威胁
Decorator learning 01
MATLAB | App Designer·我用MATLAB制作了一款LATEX公式实时编辑器
Huawei fast game failed to call the login interface, and returned error code -1
ICMP 介绍
随机推荐
Code bug correction, char is converted to int high-order symbol extension, resulting in changes in positivity and negativity and values. Int num = (int) (unsigned int) a, which will occur in older com
Serializability of concurrent scheduling
Poj3414 extensive search
从零开始实现lmax-Disruptor队列(四)多线程生产者MultiProducerSequencer原理解析
Leetcode simple question: check whether each row and column contain all integers
极狐公司官方澄清声明
Performance monitoring of database tuning solutions
Type of fault
An exception occurred in Huawei game multimedia calling the room switching method internal system error Reason:90000017
Interprocess communication in the "Chris Richardson microservice series" microservice architecture
【愚公系列】2022年7月 Go教学课程 003-IDE的安装和基本使用
How to add new fields to mongodb with code (all)
科技云报道荣膺全球云计算大会“云鼎奖”2013-2022十周年特别贡献奖
The simple problem of leetcode is to split a string into several groups of length K
About the writing method of SQL field "this includes" and "included in" strings
Create a virtual machine on VMware (system not installed)
2022-07-05:给定一个数组,想随时查询任何范围上的最大值。 如果只是根据初始数组建立、并且以后没有修改, 那么RMQ方法比线段树方法好实现,时间复杂度O(N*logN),额外空间复杂度O(N*
Poj3414广泛搜索
如何组织一场实战攻防演练
A number of ventilator giants' products have been recalled recently, and the ventilator market is still in incremental competition