Home  >  Article  >  Web Front-end  >  What is front-end MVVM?

What is front-end MVVM?

Guanhui
GuanhuiOriginal
2020-06-24 16:52:585034browse

Front-end MVVM is a software architecture design pattern. It is essentially an improved version of MVC, which abstracts the state and behavior of the View and allows developers to separate the view UI and business logic. This pattern The advantages are low coupling, reusability, independent development and testability.

What is front-end MVVM?

MVVM is the abbreviation of Model-View-ViewModel. It is essentially an improved version of MVC. MVVM abstracts the state and behavior of the View, allowing us to separate the view UI and business logic. Of course, ViewModel has already done these things for us. It can take out the Model data and help handle the business logic involved in the View that needs to display content. Microsoft's WPF brings new technical experiences, such as Silverlight, audio, video, 3D, animation..., which results in the software UI layer being more detailed and customizable. At the same time, at the technical level, WPF also brings new features such as Binding, Dependency Property, Routed Events, Command, DataTemplate, ControlTemplate and so on. The origin of the MVVM (Model-View-ViewModel) framework is a new architectural framework that evolved from the application method of combining the MVP (Model-View-Presenter) pattern with WPF. It is based on the original MVP framework and incorporates the new features of WPF to cope with increasingly complex changes in customer needs.

MVVM logic diagram

What is front-end MVVM?

##Components of the MVVM pattern

What is front-end MVVM?

Model

The model refers to the domain model (object-oriented) that represents the real state content, or the data access layer (data-centric) that represents the content ).

View

Just like in MVC and MVP patterns, the view is the structure, layout and appearance (UI) that the user sees on the screen.

View Model

A view model is an abstraction of a view that exposes public properties and commands. MVVM does not have an MVC mode controller, nor an MVP mode presenter, but a binder. In a view model, binders communicate between the view and the data binder.

Binders

Declarative data and command bindings are implicit in the MVVM pattern. In the Microsoft solution stack, the binder is a markup language called XAML. Binders save developers from being forced to write boilerplate logic to synchronize view models and views. The emergence of declarative data binding technology was a key factor in enabling this pattern when implemented outside of Microsoft's heap.

Recommended tutorial: "

JS Tutorial"

The above is the detailed content of What is front-end MVVM?. For more information, please follow other related articles on the PHP Chinese website!

Statement:
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