Home > Web Front-end > JS Tutorial > body text

Understanding MVVM

angryTom
Release: 2020-02-06 10:01:52
Original
4205 people have browsed it

Understanding MVVM

Understanding of MVVM

Overview

MVVM It is a variant and advancement of MVC. Conceptually, it is a model that truly separates page and data logic. It puts the data binding work into a JS to implement, and the main function of this JS file is to complete data binding. That is, bind the model to the elements of the UI.

MVVM mode can be divided into:

M----> model model layer (generally used for data storage, storing some business logic), That is what we call the data model.

V-----> view view layer (interface), used to display data.

VM—> ViewModel (view model), which is $scope.

In actual applications, more page interactions are performed, and the final processing is submitted to the server all at once (weakening the function of the controller in MVC), which enhances the use of views and models, so the This is called MVVM.

Advantages of MVVM pattern

● Low coupling: View can change and modify independently of Model, and the same ViewModel can be duplicated by multiple Views It can be used; and changes in View and Model can be made without affecting each other;

● Reusability: You can put some view logic in ViewModel to reuse multiple Views;

● Independent development: Developers can focus on the development of business logic and data;

● Testability: The clear View layering makes it easier and simpler to test the business logic of the presentation layer.

This article comes from the js tutorial column, welcome to learn!

The above is the detailed content of Understanding MVVM. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template