1、Vue.nextTick(callback),当数据发生变化,更新后执行回调。
2、Vue.$nextTick(callback),当dom发生变化,更新后执行的回调。
例如:
this
.
list
.
push
(
1
);
this
.
nextTick
(
function
(){
alert
(
'数据已经更新'
);
});
this
.
$nextTick
(
function
(){
alert
(
'v-for渲染已经完成'
);
})