SoFunction
Updated on 2025-04-09

vue2.0$nextTick listens to callback function method after data rendering is completed

vue itself contains two callback functions:

One is `(callback)`, and when the data changes, a callback is executed after update.

The other is `Vue.$nextTick(callback)`, which is executed after update when the dom changes.

chestnut:

 ...
<ul >
 <li v-for="item in list">{{item}}</div>
</ul>
...
new Vue({
 el:'#demo',
 data:{
  list=[0,1,2,3,4,5,6,7,8,9,10]
 },
 methods:{
  push:function(){
   (11);
   (function(){
    alert('The data has been updated')
   });
   this.$nextTick(function(){
    alert('v-for rendering has been completed')
   })
  }
 }
})

The above vue2.0$nextTick listening data rendering method is all the content I share with you. I hope you can give you a reference and I hope you support me more.