当前位置:网站首页>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 .
边栏推荐
- The code generator has deoptimised the styling of xx/typescript.js as it exceeds the max of 500kb
- Wonderful review of the digital Expo | highlight scientific research strength, and Zhongchuang computing power won the digital influence enterprise award
- Metaverse Ape猿界应邀出席2022·粤港澳大湾区元宇宙和web3.0主题峰会,分享猿界在Web3时代从技术到应用的文明进化历程
- Distributed solution selection
- 513. Find the value in the lower left corner of the tree
- Editor extensions in unity
- Character conversion PTA
- Win11运行cmd提示“请求的操作需要提升”的解决方法
- Business introduction of Zhengda international futures company
- 谷歌地图案例
猜你喜欢
點到直線的距離直線的交點及夾角
What if win11 is missing a DLL file? Win11 system cannot find DLL file repair method
点到直线的距离直线的交点及夹角
MySQL服务莫名宕机的解决方案
Metaverse Ape上线倒计时,推荐活动火爆进行
Double pointeur de liste liée (pointeur rapide et lent, pointeur séquentiel, pointeur de tête et de queue)
The difference between MVVM and MVC
鏈錶之雙指針(快慢指針,先後指針,首尾指針)
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
A trip to Suzhou during the Dragon Boat Festival holiday
随机推荐
[error record] groovy function parameter dynamic type error (guess: groovy.lang.missingmethodexception: no signature of method)
513. Find the value in the lower left corner of the tree
Opencv judgment points are inside and outside the polygon
APK加固技术的演变,APK加固技术和不足之处
第一讲:蛇形矩阵
MySQL服务莫名宕机的解决方案
The statistics of leetcode simple question is the public string that has appeared once
50. Pow(x, n). O(logN) Sol
BFC block level formatting context
The code generator has deoptimised the styling of xx/typescript. js as it exceeds the max of 500kb
IIC bus realizes client device
MySQL actual combat 45 lecture learning (I)
90后测试员:“入职阿里,这一次,我决定不在跳槽了”
[Chongqing Guangdong education] National Open University autumn 2018 0088-21t Insurance Introduction reference questions
Platform bus
Wonderful review of the digital Expo | highlight scientific research strength, and Zhongchuang computing power won the digital influence enterprise award
Nacos installation and service registration
Oracle views the data size of a table
Editor extensions in unity
Three "factions" in the metauniverse