Front-end development MVVM

Mvvm is defined MVVM Model-View-ViewModel shorthand.

That model - view - view model.

Model refers to a rear end of the data transfer.

View refers seen pages.

View core mvvm mode model, it is the link between the view and model. It has two directions:

First, the model into view , the back-end data transfer is about to be converted into pages to see. Way to achieve that: data binding.

Second, the transformation into a model view , see page soon converted into back-end data. Way to achieve that: DOM event listener. Both directions are implemented, we call two-way data binding.

Summary: In the framework MVVM view and the model can not communicate directly.

They usually achieved by ViewModel communicate, a ViewModel Observer observer, when the data is changed, this change ViewModel able to listen to the data, and then notifies the corresponding view done automatically updated when the user operates the view, but also can monitor ViewModel to change the view, and then make changes to the notification data, which is actually on the realization of the data two-way binding . The View and MVVM ViewModel and can communicate with each other.

Guess you like

Origin www.cnblogs.com/CWJDD/p/11464951.html