Vue MVVM model

Article archived at: https://www.yuque.com/u27599042/front-end


  • MVVM is the core principle of Vue to implement data-driven views and two-way data binding.
  • In the MVVM model, it mainly consists of the following three parts:
    • M: Model, model, which is the data to be rendered to the view.
    • V: View, view, data rendering position
    • VM: ViewModel, view model, can be regarded as a bridge between Model and View. VM is the core of MVVM. VM connects the data Model to be rendered to the view and the view where the data is rendered.
  • The MVVM model realizes the decoupling between the view and the data model.
  • Take Vue as an example to illustrate the working principle of MVVM:
    • In Vue, the Vue instance object plays the role of the VM in MVVM. The Vue instance object renders the data in the Model into the view through data binding. When the data source Model changes, the Vue instance object will trigger the View updates; at the same time, the Vue instance object will also monitor changes in the view. When the data values ​​related to the Model in the view are modified, the Vue instance object can monitor the change, thus triggering the synchronization of the data in the data source Model.

Guess you like

Origin blog.csdn.net/m0_53022813/article/details/132461983