当前位置:网站首页>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 .
边栏推荐
- EL与JSTL注意事项汇总
- 华为游戏多媒体服务调用屏蔽指定玩家语音方法,返回错误码3010
- Blocking protocol for concurrency control
- 【愚公系列】2022年7月 Go教学课程 004-Go代码注释
- Implementing Lmax disruptor queue from scratch (IV) principle analysis of multithreaded producer multiproducersequencer
- The American Championship is about to start. Are you ready?
- ICMP 介绍
- Leetcode simple question: the minimum cost of buying candy at a discount
- 1.3 years of work experience, double non naked resignation agency face-to-face experience [already employed]
- Code bug correction, char is converted to int high-order symbol extension, resulting in changes in positivity and negativity and values. Int num = (int) (unsigned int) a, which will occur in older com
猜你喜欢
2022-07-05:给定一个数组,想随时查询任何范围上的最大值。 如果只是根据初始数组建立、并且以后没有修改, 那么RMQ方法比线段树方法好实现,时间复杂度O(N*logN),额外空间复杂度O(N*
Oracle triggers
Database tuning solution
Business learning of mall commodity module
Huawei fast game failed to call the login interface, and returned error code -1
Create a virtual machine on VMware (system not installed)
Getting started with microservices (resttemplate, Eureka, Nacos, feign, gateway)
Blocking of concurrency control
资深电感厂家告诉你电感什么情况会有噪音电感噪音是比较常见的一种电感故障情况,如果使用的电感出现了噪音大家也不用着急,只需要准确查找分析出什么何原因,其实还是有具体的方法来解决的。作为一家拥有18年品牌
U盘的文件无法删除文件怎么办?Win11无法删除U盘文件解决教程
随机推荐
如何向mongoDB中添加新的字段附代码(全)
U盘的文件无法删除文件怎么办?Win11无法删除U盘文件解决教程
Database tuning solution
Oracle hint understanding
Image editor for their AutoLayout environment
An exception occurred in Huawei game multimedia calling the room switching method internal system error Reason:90000017
【愚公系列】2022年7月 Go教学课程 004-Go代码注释
了解 Android Kotlin 中 DataStore 的基本概念以及为什么应该停止在 Android 中使用 SharedPreferences
Countdown to 92 days, the strategy for the provincial preparation of the Blue Bridge Cup is coming~
crm创建基于fetch自己的自定义报告
Yolov5 training custom data set (pycharm ultra detailed version)
Codeforces 12D ball tree array simulation 3 sorting elements
EBS Oracle 11g cloning steps (single node)
Huawei game multimedia service calls the method of shielding the voice of the specified player, and the error code 3010 is returned
Defect detection - Halcon surface scratch detection
Ad637 notes d'utilisation
Database recovery strategy
Hysbz 2243 staining (tree chain splitting)
MySQL连接断开报错MySQLdb._exceptions.OperationalError 4031, The client was disconnected by the server
Poj 3237 Tree (Tree Chain Split)