当前位置:网站首页>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 .
边栏推荐
- Sentinel production environment practice (I)
- Hysbz 2243 staining (tree chain splitting)
- Database recovery strategy
- Installation of VMware Workstation
- boundary IoU 的计算方式
- Performance monitoring of database tuning solutions
- Daily question brushing record (XIV)
- AD637 usage notes
- A long's perception
- poj 3237 Tree(樹鏈拆分)
猜你喜欢
EBS Oracle 11g cloning steps (single node)
Daily question brushing record (XIV)
Interprocess communication in the "Chris Richardson microservice series" microservice architecture
CA certificate trampled pit
MySQL disconnection reports an error MySQL ldb_ exceptions. OperationalError 4031, The client was disconnected by the server
Talking about MySQL index
The real situation of programmers
Implementing Lmax disruptor queue from scratch (IV) principle analysis of multithreaded producer multiproducersequencer
总结出现2xx、3xx、4xx、5xx状态码的原因
[Yugong series] go teaching course in July 2022 004 go code Notes
随机推荐
华为联机对战如何提升玩家匹配成功几率
QML reported an error expected token ";", expected a qualified name ID
Summary of concurrency control
SecureCRT使用提示
数博会精彩回顾 | 彰显科研实力,中创算力荣获数字化影响力企业奖
Huawei game multimedia service calls the method of shielding the voice of the specified player, and the error code 3010 is returned
华为快游戏调用登录接口失败,返回错误码 -1
数据泄露怎么办?'华生·K'7招消灭安全威胁
NET中小型企业项目开发框架系列(一个)
1.3 years of work experience, double non naked resignation agency face-to-face experience [already employed]
装饰器学习01
Shell script, awk uses if, for process control
Database tuning solution
Poj 3237 Tree (Tree Chain Split)
Summary of El and JSTL precautions
[Yugong series] go teaching course in July 2022 004 go code Notes
Sentinel production environment practice (I)
多家呼吸机巨头产品近期被一级召回 呼吸机市场仍在增量竞争
A trip to Suzhou during the Dragon Boat Festival holiday
Livelocks and deadlocks of concurrency control