当前位置:网站首页>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 .

边栏推荐
- Index optimization of performance tuning methodology
- NET中小型企业项目开发框架系列(一个)
- Two stage locking protocol for concurrency control
- Reptile practice
- Form artifact
- Advantages and disadvantages of the "Chris Richardson microservice series" microservice architecture
- Database tuning solution
- 从零开始实现lmax-Disruptor队列(四)多线程生产者MultiProducerSequencer原理解析
- poj 3237 Tree(树链拆分)
- HDU 4391 paint the wall segment tree (water
猜你喜欢

ICMP 介绍

总结出现2xx、3xx、4xx、5xx状态码的原因

How to use tensorflow2 for cat and dog classification and recognition

多家呼吸机巨头产品近期被一级召回 呼吸机市场仍在增量竞争

Meituan dynamic thread pool practice ideas, open source

Performance monitoring of database tuning solutions

Oracle advanced query

AD637使用筆記

ICMP introduction

Efficiency difference between row first and column first traversal of mat data types in opencv
随机推荐
Summary of concurrency control
2022-07-05:给定一个数组,想随时查询任何范围上的最大值。 如果只是根据初始数组建立、并且以后没有修改, 那么RMQ方法比线段树方法好实现,时间复杂度O(N*logN),额外空间复杂度O(N*
Serializability of concurrent scheduling
MySQL连接断开报错MySQLdb._exceptions.OperationalError 4031, The client was disconnected by the server
笔记本电脑蓝牙怎么用来连接耳机
装饰器学习01
A long's perception
Business learning of mall order module
Interprocess communication in the "Chris Richardson microservice series" microservice architecture
Installation of VMware Workstation
ICMP 介绍
Livelocks and deadlocks of concurrency control
AD637使用筆記
[Yugong series] go teaching course 003-ide installation and basic use in July 2022
从零开始实现lmax-Disruptor队列(四)多线程生产者MultiProducerSequencer原理解析
A number of ventilator giants' products have been recalled recently, and the ventilator market is still in incremental competition
Pl/sql basic syntax
QML reported an error expected token ";", expected a qualified name ID
Meituan dynamic thread pool practice ideas, open source
Did you brush the real title of the blue bridge cup over the years? Come here and teach you to counter attack!