What is Vue? How does Vue work?

Vue (pronounced /Vju:/, similar to View) is a progressive framework for building user interfaces. Compared with other large frameworks, Vue is designed to be applied layer by layer from the bottom up. Other large-scale frameworks often impose mandatory requirements on the technical solution of the project from the beginning, and Vue is more flexible. Developers can choose to use Vue to develop a new project or introduce Vue into an existing project.

On the other hand, when Vue is used in combination with modern tool chains and various supporting libraries, it can also provide drivers for complex single-page applications. Toolchain refers to a series of tools used in the front-end development process, for example, using scaffolding tools to create applications, using dependency management tools to install dependency packages, and using build tools to compile code.

Vue's data drive is realized through the MVVM (Model-View-ViewModel) mode, and its basic working principle is shown in the figure below.

1615283232232.png

The basic working principle of VUE

As can be seen from the above figure, MVVM mainly contains 3 parts, namely Model, View and ViewModel. Model refers to the data part, which is mainly responsible for business data; View refers to the view part, that is, the DOM element, which is responsible for the processing of the view. ViewModel is a data model that connects views and data, and is responsible for monitoring Model or View modifications.

In MVVM, the data (Model) and the view (View) cannot communicate directly, and the view model (ViewModel) is equivalent to an observer, monitoring the actions of both parties, and promptly notify the corresponding operations. When the Model changes, the ViewModel can monitor the changes and notify the View to make corresponding changes in time. On the contrary, when the View changes, after the ViewModel monitors the change, it notifies the Model to make changes, which realizes the decoupling of the view and the model.

What is Vue? How does Vue work? Did you understand through the above introduction? You can also pay attention to Xiaoqian for web front-end related technical issues. More technical content and industry information will be released later, waiting for you~~~~


Guess you like

Origin blog.51cto.com/15128702/2662634