vue Note

  • $ NextTick: After modifying the data Data, the data component of the reference cited does not change immediately, as with a $ nextTick reference value is changed after the component data.
<div ref="dom">{{ this.msg }}</div>
{{ this.msg1 }}
{{ this.msg2 }}
data(){
  return {
    msg: 'Hello',
    msg1: '',
    msg2: ''  
   }  
},
mounted(){
  this.msg = 'HAHA';
  this.msg1 = this.$refs.dom.innerHTML;
this.$nextTick(function(){
this.msg2 =
this.$refs.dom.innerHTML;
})
}

display:

HAHA
Hello
HAHA

 

Guess you like

Origin www.cnblogs.com/shirliey/p/10955592.html