当前位置:网站首页>MVC and MVVM
MVC and MVVM
2022-07-06 23:43:00 【Panda-6】
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
2 . model The data layer
data: {
name: '' --Model layer
}
3 .VM layer
VUE The frame is encapsulated
new Vue({
…})
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 .
边栏推荐
- Detailed explanation of regular expression (regexp) in MySQL
- The worse the AI performance, the higher the bonus? Doctor of New York University offered a reward for the task of making the big model perform poorly
- The intranet penetrates the zerotier extranet (mobile phone, computer, etc.) to access intranet devices (raspberry pie, NAS, computer, etc.)
- Pdf batch splitting, merging, bookmark extraction, bookmark writing gadget
- MATLIB reads data from excel table and draws function image
- MySQL implementation of field segmentation from one line to multiple lines of example code
- Design a red envelope grabbing system
- B 站弹幕 protobuf 协议还原分析
- Why is bat still addicted to 996 when the four-day working system is being tried out in Britain?
- The programmer refused the offer because of low salary, HR became angry and netizens exploded
猜你喜欢
The problem of ASP reading Oracle Database
JS addition, deletion, modification and query of JSON array
Entropy information entropy cross entropy
【OFDM通信】基于深度学习的OFDM系统信号检测附matlab代码
How to find out if the U disk file of the computer reinstallation system is hidden
The intranet penetrates the zerotier extranet (mobile phone, computer, etc.) to access intranet devices (raspberry pie, NAS, computer, etc.)
Station B Big utilise mon monde pour faire un réseau neuronal convolutif, Le Cun Forward! Le foie a explosé pendant 6 mois, et un million de fois.
Daily question brushing record (XV)
The method of reinstalling win10 system is as simple as that
koa2对Json数组增删改查
随机推荐
How to implement Lua entry of API gateway
What does front-end processor mean? What is the main function? What is the difference with fortress machine?
How can Oracle CDC deserialize with jsondebeziumdeserializationschema
Common modification commands of Oracle for tables
(LeetCode)两数之和
Koa2 addition, deletion, modification and query of JSON array
每人每年最高500万经费!选人不选项目,专注基础科研,科学家主导腾讯出资的「新基石」启动申报...
koa2对Json数组增删改查
AI表现越差,获得奖金越高?纽约大学博士拿出百万重金,悬赏让大模型表现差劲的任务...
Summary of three methods for MySQL to view table structure
Is the more additives in food, the less safe it is?
Experiment 5: common automation libraries
达晨史上最大单笔投资,今天IPO了
Design a red envelope grabbing system
MATLIB从excel表中读取数据并画出函数图像
How to find out if the U disk file of the computer reinstallation system is hidden
Stop saying that microservices can solve all problems
mysql-cdc 的jar包 ,在flink运行模式下,是不是要放在不同的地方呢?
JS addition, deletion, modification and query of JSON array
Station B boss used my world to create convolutional neural network, Lecun forwarding! Burst the liver for 6 months, playing more than one million