v-model and VUE initialization flashing

v-model

Syntactic sugar

v-bind="message" @input="message=$event.target.value"

V-model uses the Object.defineProperty method
Object.defineProperty (the object to add or modify properties, …property name, feature object).
When adding a property, you can set the following properties of the property:
1. Whether it is read-only
2. Whether it can be deleted
3. Whether it can be traversed
4. It is possible to register a function like a change event for the property

Example:

let nameValue = ''
let obj = {
    
    }
Object.defineProperty(obj, 'name', {
    
    
	set(value){
    
    
		console.log('属性被赋值')
		nameValue = value
		},
	get(){
    
    
		console.log('属性被获取值')
		return nameValue
		}
	})

VUE initialization flashes

  1. Root element plus
style="display:none;" :style="{display:block;}"
  1. Use v-clock
[v-clock]{
    
    
	display:none;
}

Guess you like

Origin blog.csdn.net/Menqq/article/details/111598671