当前位置:网站首页>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 .
边栏推荐
- Golang writes the opening chapter of selenium framework
- opencv 判断点在多边形内外
- Metaverse Ape获Negentropy Capital种子轮融资350万美元
- The code generator has deoptimised the styling of xx/typescript. js as it exceeds the max of 500kb
- Understand the basic concept of datastore in Android kotlin and why SharedPreferences should be stopped in Android
- What about data leakage? " Watson k'7 moves to eliminate security threats
- 笔记本电脑蓝牙怎么用来连接耳机
- QT creator 7 beta release
- H5c3 advanced - player
- Oracle is sorted by creation time. If the creation time is empty, the record is placed last
猜你喜欢

Metaverse Ape获Negentropy Capital种子轮融资350万美元

MySQL actual combat 45 lecture learning (I)

Opencv judgment points are inside and outside the polygon

Win11 runs CMD to prompt the solution of "the requested operation needs to be promoted"

Leetcode simple question: the minimum cost of buying candy at a discount

我把开源项目alinesno-cloud-service关闭了

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

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

2022-07-05: given an array, you want to query the maximum value in any range at any time. If it is only established according to the initial array and has not been modified in the future, the RMQ meth

Event trigger requirements of the function called by the event trigger
随机推荐
FBO and RBO disappeared in webgpu
Text组件新增内容通过tag_config设置前景色、背景色
[untitled]
Distributed resource management and task scheduling framework yarn
MCU case -int0 and INT1 interrupt count
Go语言学习教程(十五)
Why does the C# compiler allow an explicit cast between IEnumerable&lt; T&gt; and TAlmostAnything?
Sub total of Pico development
[Chongqing Guangdong education] National Open University autumn 2018 0088-21t Insurance Introduction reference questions
南京:全面启用商品房买卖电子合同
My experience and summary of the new Zhongtai model
2022-07-05: given an array, you want to query the maximum value in any range at any time. If it is only established according to the initial array and has not been modified in the future, the RMQ meth
Metaverse ape ape community was invited to attend the 2022 Guangdong Hong Kong Macao Great Bay metauniverse and Web3.0 theme summit to share the evolution of ape community civilization from technology
从 1.5 开始搭建一个微服务框架——日志追踪 traceId
opencv 判断点在多边形内外
Metaverse Ape上线倒计时,推荐活动火爆进行
QT creator 7-cmake update
Nacos 的安装与服务的注册
The new content of the text component can be added through the tag_ Config set foreground and background colors
等到产业互联网时代真正发展成熟,我们将会看待一系列的新产业巨头的出现