Watch observation attribute
Watch is the observation attribute of Vue. The object observed by Watch must be the object in data. When the observation attribute is changed, a function is called.
new Vue({
el:"#app".data: {message:"hello world"},watch: {message(){
console.log('Listen for message value changed :' + this.message); }}})Copy the code
Computed properties
Compute is a compute property. When the program first comes in, it executes the compute property, it caches the compute result, it depends on the compute factor, it doesn’t recalculate no matter how many times the compute factor is used, it recalculates when the compute factor changes, And cache the result of this calculation for next use.
Event modifier
Stop prevents event delivery such as bubblers and catch once. This modifier causes the event to be executed only once. If there is an event modifier before, n then the preceding event is executed only once. Prevent prevents default events such as a link jump.
Key modifier
Key event: keyDown When the key is pressed keyUp when the key is lifted KeyPress When the key is pressed enter Space ESC deleteTab up Down left right
System modifier
shift alt ctrl windows
The filter
Filter, filter out what you don’t want, or add something you do want. The global registry is written before the Vue instance
Vue.filter('changeName'.function (value) {
return
})
Copy the code
Local registrations are written to the Vue instance
filterFirst(value) {
return + value
}
}
Copy the code
Usage: $options. Filters. FilterFirs {{message | filterFirst}}