search

Home  >  Q&A  >  body text

vue.js - What is the difference between ViewModel and Controller?

vue.js belongs to the MVVM framework, and angularjs belongs to the MVC framework, right? What's the difference between them in this aspect?
What is the difference between VM in MVVM and C in MVC framework?

習慣沉默習慣沉默2828 days ago678

reply all(2)I'll reply

  • 高洛峰

    高洛峰2017-05-16 17:07:24

    Simply put, the tasks that the Controller has to perform are more comprehensive, including a lot of business logic. The ViewModel simplifies or even eliminates the business logic. The main job is just to assemble the data in the Model into data suitable for use by the View.
    Compared to Vue, Angular is indeed an MVC framework. In fact, for the front-end, little or no business logic is required, so the back-end design structure of MVC is actually not suitable. Therefore, structures such as MVP and MVVM that weaken business logic are becoming more and more popular in the front-end field.

    reply
    0
  • 漂亮男人

    漂亮男人2017-05-16 17:07:24

    MVC
    Routing to the controller, the controller needs to process the model (data) by itself, and then re-render to generate the view (UI)

    MVVM
    Data-driven, once the model changes, its view (UI) will change.

    reply
    0
  • Cancelreply