* `Vue.nextTick(callback)`,当数据发生变化,更新后执行回调。
* `Vue.$nextTick(callback)`,当dom发生变化,更新后执行的回调。
* `Vue.$nextTick(callback)`,当dom发生变化,更新后执行的回调。
标签:pre scroll www. javascrip index def for use com
<ul id="demo"> <li v-for="item in list">{{item}}</div> </ul> <script> new Vue({ el:‘#demo‘, data:{ list=[0,1,2,3,4,5,6,7,8,9,10] }, methods:{ push:function(){ this.list.push(11); this.nextTick(function(){ console.log(‘数据已经更新‘) }); this.$nextTick(function(){ console.log(‘v-for渲染已经完成‘) }) } }}) </script>
标签:pre scroll www. javascrip index def for use com
原文地址:https://www.cnblogs.com/DreamSeeker/p/5a45948731548b2339e9759b96f139b6.html