当前位置:网站首页>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 .
边栏推荐
- Should the jar package of MySQL CDC be placed in different places in the Flink running mode?
- Stop saying that microservices can solve all problems
- 每日刷题记录 (十五)
- 英国都在试行4天工作制了,为什么BAT还对996上瘾?
- Without CD, I'll teach you a trick to restore the factory settings of win10 system
- Unity 颜色板|调色板|无级变色功能
- Can online reload system software be used safely? Test use experience to share with you
- Matplotlib draws a histogram and adds values to the graph
- Who said that new consumer brands collapsed? Someone behind me won
- Is the more additives in food, the less safe it is?
猜你喜欢
Entropy information entropy cross entropy
Nftscan Developer Platform launches Pro API commercial services
Gradle knowledge generalization
Do you still have to rely on Simba to shout for a new business that is Kwai?
Zero code and high return. How to use 40 sets of templates to meet 95% of the reporting needs in the work
Gpt-3 is a peer review online when it has been submitted for its own research
每人每年最高500万经费!选人不选项目,专注基础科研,科学家主导腾讯出资的「新基石」启动申报...
Stop saying that microservices can solve all problems
MATLIB从excel表中读取数据并画出函数图像
每日刷题记录 (十五)
随机推荐
Zero code and high return. How to use 40 sets of templates to meet 95% of the reporting needs in the work
With the help of this treasure artifact, I became the whole stack
Isomorphism + cross end, knowing applet +kbone+finclip is enough!
11 preparations for Web3 and Decentralization for traditional enterprises
The best sister won the big factory offer of 8 test posts at one go, which made me very proud
What should I do if the USB flash disk data is formatted and how can I recover the formatted USB flash disk data?
Scholar doctor hahaha
Realize colorful lines and shape your heart
STM32 enters and wakes up the stop mode through the serial port
谁说新消费品牌大溃败?背后有人赢麻了
MySQL implementation of field segmentation from one line to multiple lines of example code
The problem of ASP reading Oracle Database
Newsletter L Huobi ventures is in-depth contact with genesis public chain
亚朵三顾 IPO
Yaduo Sangu IPO
Daily question brushing record (XV)
Who said that new consumer brands collapsed? Someone behind me won
Pdf batch splitting, merging, bookmark extraction, bookmark writing gadget
Ajout, suppression et modification d'un tableau json par JS
AI金榜题名时,MLPerf榜单的份量究竟有多重?