当前位置:网站首页>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 .
边栏推荐
- 不要再说微服务可以解决一切问题了
- Per capita Swiss number series, Swiss number 4 generation JS reverse analysis
- Use mitmproxy to cache 360 degree panoramic web pages offline
- How can Oracle CDC deserialize with jsondebeziumdeserializationschema
- Efficient ETL Testing
- 每年 2000 亿投资进入芯片领域,「中国芯」创投正蓬勃
- 英国都在试行4天工作制了,为什么BAT还对996上瘾?
- 传统企业要为 Web3 和去中心化做的 11 个准备
- Design a red envelope grabbing system
- 这个『根据 op 值判断操作类型来自己组装 sql』是指在哪里实现?是指单纯用 Flink Tabl
猜你喜欢

Please help xampp to do sqlilab is a black

Nftscan Developer Platform launches Pro API commercial services
Detailed explanation of regular expression (regexp) in MySQL

The "white paper on the panorama of the digital economy" has been released with great emphasis on the digitalization of insurance

GPT-3当一作自己研究自己,已投稿,在线蹲一个同行评议

Gold three silver four, don't change jobs

The programmer said, "I'm 36 years old, and I don't want to be rolled, let alone cut."
Implementation steps of mysql start log in docker

Why is bat still addicted to 996 when the four-day working system is being tried out in Britain?

Stop saying that microservices can solve all problems
随机推荐
Where does this "judge the operation type according to the op value and assemble SQL by yourself" mean? It means simply using Flink tab
Docker mysql5.7 how to set case insensitive
AI金榜题名时,MLPerf榜单的份量究竟有多重?
Can online reload system software be used safely? Test use experience to share with you
零代码高回报,如何用40套模板,能满足工作中95%的报表需求
设计一个抢红包系统
浅谈现在的弊端与未来的发展
The problem of ASP reading Oracle Database
人均瑞数系列,瑞数 4 代 JS 逆向分析
Is the more additives in food, the less safe it is?
Station B boss used my world to create convolutional neural network, Lecun forwarding! Burst the liver for 6 months, playing more than one million
Computer reinstallation system teaching, one click fool operation, 80% of people have learned
(1) Chang'an chain learning notes - start Chang'an chain
Gradle knowledge generalization
传统企业要为 Web3 和去中心化做的 11 个准备
Unity color palette | color palette | stepless color change function
Microsoft win11 is still "unsatisfactory". Multi user feedback will cause frequent MSI crashes
【无人机】多无人协同任务分配程序平台含Matlab代码
With the help of this treasure artifact, I became the whole stack
今日睡眠质量记录78分