2019/9/18 view-o2

Calculation of property (computed) : When the data within the template needs to do some complex operation when you need to use to calculate property to solve, because the template is designed for simple operation, put too much logic operation in the template templates will be too heavy and difficult to maintain, and calculates property has a cache function for particularly large amount of calculation logic operations, without changing dependencies calculated property, he will direct the last results directly rather than take over then recalculated again, with respect to methods for improving performance, so you want to use to calculate property.

Calculate property cache:

Internal vue calculated property caching done, he will observe calculated attribute depends whether the data changes, if not the direct result of the last calculation updated to take over the page, rather than restart the calculation, compared to methods for improve the performance, methods that every time processing of complex logic that you want to be recalculated.

Calculating attribute get and set methods:

The method of calculating the properties generally do not set, only read

Under normal circumstances set method is not required to implement, so the method is an empty set, we do not want people just to our calculations set the value of the property, so we generally do not write set method, only the get method. After shorthand method will only get a return ..

v-model binding form

Form controls in the actual development is very common. In particular information submitted by the user. It requires a lot of forms.

Using v-model instruction vue form elements and be implemented in two-way data binding

V-model underlying the amount actually instruction: 1, v-bind a binding value. 2, v-on instruction to a current input element binding event.      

Componentization (we will complete a page into a number of components, each page are used to implement a function block, and each component and can be broken down):

If all processing logic that we will all put a page together, to deal with them becomes very complicated, and not conducive to the management and expansion, but we will if a page split into a small function fast, each functional block completed its own independent function so that management and maintenance of the entire page becomes very easy.

 

 

 

 

 

 

 

 

            

Guess you like

Origin www.cnblogs.com/xiaoshiqi/p/11545970.html