How to understand MVVM (Model-View-ViewModel)?

MVVM of  produce / achieve / develop can write a long blog, the only person to write about here MVVM few superficial understanding. 

1. In the absence MVVM before, the front end can be said to jQuery a shuttle , jQuery solution is to write the front page needs to interact / function frequently operate dom this pain point, in simplified dom operation on this point, no more than the library jQuery more good. but also solve most browser compatibility problems  , with up indescribably cool.

 

2. However, as network speed faster / phone performance  is getting better, we feel that we can have in the pages more articles on, and HTML5 and ES6 appear to developers web page to make the application to provide a great Conveniently, when people discovered that very easy to use jQuery slowly become inappropriate because it does not address because of frequent call DOM arising from performance issues  , nor simplify developers needed when dealing with user interaction with the page business logic

 

3. In order to solve the above problems, MVVM  architecture came into being,  Model-View-ViewModel this idea may be subject to a service side of the MVC architecture ( Model-View-Controler ) inspired, but MVVM specific pain points for the front end, to strengthen the Controler , namely: ViewModel , we can think MVVM inside the core is the most ViewModel it. View and Model separation will achieve a logic and display separation, so we can do the same as before the operation often requires the DOM , also do not need to manually update the data (model) and the page (view) all this,. ViewModel have been doing for us, we need to do is only two: 1. write the page . 2. write logicAs for how to link pages together and interact logic, ViewModel said: This thing you do not have control, let me ~.

 

 

4. To sum up, MVVM can be seen as MVC architecture for the front end of the main development scenarios derived from the subset , its views and models were strictly separate , strengthened Controler , so as to solve in the development of modern Web applications encountered when pain points.

 

Guess you like

Origin www.cnblogs.com/aisowe/p/11432722.html