[1118 | Day61] vue in methods / computed / filters / watch method

A .methods

methods of property which method will be set when the data changes you, as long as the reference points inside this method, the method will be automatically executed. This property is not dependent cache

二.computed

The method of calculating properties of the properties the return value must have a return, the return value (value value).

There are several key points

  • 1) After calculating the attribute data does not need to be redefined in
  • 2) the property must be calculated after rendering method bindings to take effect这里指就是定义后的变量名在上面html中显示
  • 3) The method of any variable binding properties of the updated value calculation method is called比如说方法中一个变量A,变量A变了函数会重新调用
  • 4) After calculating the property is read only (non-write)计算后属性为只读属性

Three .filters

It is 过滤器属性a method of use of the methods defined in the almost

Four .watch

It is to monitor property. Listener properties the data is the data, when the data changes, automatically performs this function.

watch:{
        data中的变量(){
        当data中变量发生的时候会执行这里的逻辑函数
        }
       }

important point

  • 1) monitor the object binding, the property can get, set
  • Method) monitor object value is updated in the event, will be called bound
  • Listener object is already scheduled for the attribute data中定义or global as the $routemore commonly used routing parameter passing anyway thisthrough .out property

Guess you like

Origin www.cnblogs.com/fxyadela/p/11885460.html