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

边栏推荐
猜你喜欢

Business learning of mall order module

Oracle triggers

华为游戏多媒体服务调用屏蔽指定玩家语音方法,返回错误码3010

Countdown to 92 days, the strategy for the provincial preparation of the Blue Bridge Cup is coming~

Win11缺少dll文件怎么办?Win11系统找不到dll文件修复方法

Drawing HSV color wheel with MATLAB

The American Championship is about to start. Are you ready?

Leetcode simple question ring and rod

Pl/sql basic case

Win11运行cmd提示“请求的操作需要提升”的解决方法
随机推荐
Leetcode simple question check whether all characters appear the same number of times
Yolov5 training custom data set (pycharm ultra detailed version)
了解 Android Kotlin 中 DataStore 的基本概念以及为什么应该停止在 Android 中使用 SharedPreferences
MMAP学习
数据泄露怎么办?'华生·K'7招消灭安全威胁
Poj3414广泛搜索
华为快游戏调用登录接口失败,返回错误码 -1
Livelocks and deadlocks of concurrency control
Talking about MySQL index
阿龙的感悟
[Yugong series] go teaching course 003-ide installation and basic use in July 2022
About the writing method of SQL field "this includes" and "included in" strings
poj 3237 Tree(樹鏈拆分)
Efficiency difference between row first and column first traversal of mat data types in opencv
K210 learning notes (IV) k210 runs multiple models at the same time
深信服X计划-网络协议基础 DNS
Blocking of concurrency control
Pl/sql basic syntax
Dbeaver executes multiple insert into error processing at the same time
A trip to Suzhou during the Dragon Boat Festival holiday