当前位置:网站首页>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 .
边栏推荐
- js导入excel&导出excel
- Efficient ETL Testing
- Penetration test --- database security: detailed explanation of SQL injection into database principle
- 问下各位,有没有flink sql生成作业的文档啊或是案列啊知道flink cli可以建表和指定目
- Résumé des connaissances de gradle
- Restoration analysis of protobuf protocol of bullet screen in station B
- 内网穿透zerotier 外网(手机、电脑等)访问内网设备(树莓派、NAS、电脑等)
- Local deployment Zeppelin 0.10.1
- Gradle knowledge generalization
- 浅谈现在的弊端与未来的发展
猜你喜欢
Pdf batch splitting, merging, bookmark extraction, bookmark writing gadget
STM32 enters and wakes up the stop mode through the serial port
MySQL数据库之JDBC编程
After 3 years of testing bytecan software, I was ruthlessly dismissed in February, trying to wake up my brother who was paddling
AI金榜题名时,MLPerf榜单的份量究竟有多重?
Implementation steps of mysql start log in docker
How to find out if the U disk file of the computer reinstallation system is hidden
[communication] optimal power allocation in the uplink of two-layer wireless femtocell network with matlab code
Per capita Swiss number series, Swiss number 4 generation JS reverse analysis
Stop saying that microservices can solve all problems
随机推荐
服务器SMP、NUMA、MPP体系学习笔记。
Gpt-3 is a peer review online when it has been submitted for its own research
Entropy information entropy cross entropy
本地部署 zeppelin 0.10.1
Knowledge * review
Gradle知識概括
Pdf batch splitting, merging, bookmark extraction, bookmark writing gadget
Can online reload system software be used safely? Test use experience to share with you
MySQL connected vscode successfully, but this error is reported
If the request URL contains jsessionid, the solution
Automatically update selenium driver chromedriver
The method of reinstalling win10 system is as simple as that
传统企业要为 Web3 和去中心化做的 11 个准备
flinksql select id ,count(*) from a group by id .
MATLIB从excel表中读取数据并画出函数图像
CRMEB 商城系统如何助力营销?
JS import excel & Export Excel
What should I do if the USB flash disk data is formatted and how can I recover the formatted USB flash disk data?
The largest single investment in the history of Dachen was IPO today
There are only two TXT cells in the ArrayExpress database. Can you only download the sequencing run matrix from line to ENA?