The difference between mvc, mvp, and mvvm

reference

mvc

insert image description here

mvp

insert image description here

mvvm

With MVVH, all dom operations are operated by vm, which reduces the workload of programmers, and
programmers can spend a lot of time on business logic instead of dom operations

insert image description here
insert image description here

Why doesn't Vue fully comply with MVVM?

Although the original words of the vue official website
did not fully follow the MVVM model, the design of Vue was also inspired by it. Therefore, the variable name vm (short for ViewModel) is often used in the document to represent the Vue instance.

reason:

  1. Vue provides an attribute: ref, through which the DOM object can be obtained, and the view can be directly manipulated through the ref. At this point, it violates mvvm;
  2. When creating a new Vue instance, data needs to be transferred, which is the vm view model layer, which covers the data layerinsert image description here

Supongo que te gusta

Origin blog.csdn.net/formylovetm/article/details/127216593
Recomendado
Clasificación