当前位置:网站首页>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
- 让开发效率提升的跨端方案
- 微服务入门(RestTemplate、Eureka、Nacos、Feign、Gateway)
- 【愚公系列】2022年7月 Go教学课程 004-Go代码注释
- Analysis and test of ModbusRTU communication protocol
- crm创建基于fetch自己的自定义报告
- Regular expressions and re Libraries
- [Yugong series] go teaching course 003-ide installation and basic use in July 2022
- Learning of mall permission module
- datagrid直接编辑保存“设计缺陷”
猜你喜欢

The simple problem of leetcode is to split a string into several groups of length K

"Chris Richardson microservices series" uses API gateway to build microservices

boundary IoU 的计算方式

Win11运行cmd提示“请求的操作需要提升”的解决方法

Concurrency control of performance tuning methodology

【愚公系列】2022年7月 Go教学课程 003-IDE的安装和基本使用

华为联机对战如何提升玩家匹配成功几率

MMAP学习

Oracle hint understanding

Experienced inductance manufacturers tell you what makes the inductance noisy. Inductance noise is a common inductance fault. If the used inductance makes noise, you don't have to worry. You just need
随机推荐
poj 3237 Tree(樹鏈拆分)
Performance monitoring of database tuning solutions
Evolution of large website architecture and knowledge system
Common interview questions of redis factory
Multiplexing of Oracle control files
Two stage locking protocol for concurrency control
U盘的文件无法删除文件怎么办?Win11无法删除U盘文件解决教程
Bitbucket installation configuration
Overview of database recovery
The simple problem of leetcode is to split a string into several groups of length K
了解 Android Kotlin 中 DataStore 的基本概念以及为什么应该停止在 Android 中使用 SharedPreferences
华为快游戏调用登录接口失败,返回错误码 -1
装饰器学习01
How to use tensorflow2 for cat and dog classification and recognition
DataGrid directly edits and saves "design defects"
Oracle views the data size of a table
Tips for using SecureCRT
Livelocks and deadlocks of concurrency control
华为云ModelArts文本分类–外卖评论
科技云报道:算力网络,还需跨越几道坎?