The front end of the interview Statistical vue, js, html, css3

1. Talk about your understanding of MVVM development model

MVVM is divided into Model, View, ViewModel three.

Model represents the data model, data and business logic layer are defined in the Model;

View behalf of UI view, responsible for displaying data;

Model ViewModel responsible for monitoring changes in the data and updates the view of the control, processing user interaction;

Model and View are not directly related, but rather through contact ViewModel, has a two-way data binding link between Model and ViewModel. Therefore, when the data changes in the Model layer will trigger a refresh View, View the result of user interaction changed data will be synchronized in the Model.

This mode automatically to achieve the Model and View data synchronization, so developers only need to focus on the maintenance operations to the data, without the need for their own operations dom.

2. Brief responsive principle of Vue

When an instance is created Vue, vue will traverse attribute data options, with Object.defineProperty them into getter / setter and tracking of dependencies inside, notice the change when the property is accessed and modified.

Each component instance has a corresponding watcher program example, it is recorded as attribute dependencies in the assembly process of rendering, when the dependency after the setter is invoked, it informs the watcher recalculated, thereby causing its associated components to be updated

 

Guess you like

Origin www.cnblogs.com/wangyongsheng/p/11299000.html