当前位置:网站首页>The difference between MVVM and MVC
The difference between MVVM and MVC
2022-07-05 22:36:00 【Sen yuan】
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
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 .
边栏推荐
- 点到直线的距离直线的交点及夹角
- Win11 runs CMD to prompt the solution of "the requested operation needs to be promoted"
- Depth first DFS and breadth first BFS -- traversing adjacency tables
- Tiktok__ ac_ signature
- Request preview display of binary data and Base64 format data
- Three "factions" in the metauniverse
- Distance entre les points et les lignes
- opencv 判断点在多边形内外
- Go语言学习教程(十五)
- [secretly kill little buddy pytorch20 days] - [Day2] - [example of picture data modeling process]
猜你喜欢

A substring with a length of three and different characters in the leetcode simple question

BFC block level formatting context

2022软件测试工程师涨薪攻略,3年如何达到30K

Technology cloud report won the special contribution award for the 10th anniversary of 2013-2022 of the "cloud Ding Award" of the global cloud computing conference

Double pointeur de liste liée (pointeur rapide et lent, pointeur séquentiel, pointeur de tête et de queue)

Pl/sql basic case

MySQL服务莫名宕机的解决方案

EasyCVR集群部署如何解决项目中的海量视频接入与大并发需求?

Kubernetes Administrator certification (CKA) exam notes (IV)

从 1.5 开始搭建一个微服务框架——日志追踪 traceId
随机推荐
Interview questions for famous enterprises: Coins represent a given value
Technology cloud report: how many hurdles does the computing power network need to cross?
Nacos installation and service registration
Platform bus
Leetcode simple question: the minimum cost of buying candy at a discount
Postman core function analysis - parameterization and test report
509. Fibonacci Number. Sol
解决thinkphp启动时“No input file specified”的问题
Platformio create libopencm3 + FreeRTOS project
第一讲:蛇形矩阵
The statistics of leetcode simple question is the public string that has appeared once
APK加固技术的演变,APK加固技术和不足之处
Navigation day answer applet: preliminary competition of navigation knowledge competition
Go language learning tutorial (XV)
What if the files on the USB flash disk cannot be deleted? Win11 unable to delete U disk file solution tutorial
Assign the output of a command to a variable [repeat] - assigning the output of a command to a variable [duplicate]
119. Pascal‘s Triangle II. Sol
Common interview questions of redis factory
C language - structural basis
Stored procedures and stored functions