1. 程式人生 > >vue中nextTick和$nextTick

vue中nextTick和$nextTick

ack for back div cal 回調 class gpo lba

* `Vue.nextTick(callback)`,當數據發生變化,更新後執行回調。
* `Vue.$nextTick(callback)`,當dom發生變化,更新後執行的回調。

this.nextTick(function(){
     alert(‘數據已經更新‘)
});
this.$nextTick(function(){
     alert(‘v-for渲染已經完成‘)
})

vue中nextTick和$nextTick