当前位置:网站首页>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 simple problem of leetcode is to split a string into several groups of length K
- Evolution of APK reinforcement technology, APK reinforcement technology and shortcomings
- A substring with a length of three and different characters in the leetcode simple question
- Solutions for unexplained downtime of MySQL services
- My experience and summary of the new Zhongtai model
- 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
- 链表之双指针(快慢指针,先后指针,首尾指针)
- Nacos 的安装与服务的注册
- Editor extensions in unity
- 鏈錶之雙指針(快慢指針,先後指針,首尾指針)
猜你喜欢
第一讲:蛇形矩阵
Nacos 的安装与服务的注册
实战:fabric 用户证书吊销操作流程
Lesson 1: serpentine matrix
如何快速体验OneOS
opencv 判断点在多边形内外
Metasploit(msf)利用ms17_010(永恒之蓝)出现Encoding::UndefinedConversionError问题
我对新中台模型的一些经验思考总结
Distance from point to line intersection and included angle of line
A trip to Suzhou during the Dragon Boat Festival holiday
随机推荐
Exponential weighted average and its deviation elimination
Cobaltstrike builds an intranet tunnel
CA certificate trampled pit
New 3D particle function in QT 6.3
如何创建线程
MySQL actual combat 45 lecture learning (I)
What if the files on the USB flash disk cannot be deleted? Win11 unable to delete U disk file solution tutorial
點到直線的距離直線的交點及夾角
记录几个常见问题(202207)
南京:全面启用商品房买卖电子合同
Performance testing of software testing
How can Bluetooth in notebook computer be used to connect headphones
Unity Max and min constraint adjustment
请求二进制数据和base64格式数据的预览显示
我对新中台模型的一些经验思考总结
Pl/sql basic case
Opencv judgment points are inside and outside the polygon
The code generator has deoptimised the styling of xx/typescript. js as it exceeds the max of 500kb
APK加固技术的演变,APK加固技术和不足之处
Navigation day answer applet: preliminary competition of navigation knowledge competition