vue2.0nextTick
时间: 2023-08-03 14:08:13 浏览: 101
vue中nextTick用法实例
5星 · 资源好评率100%
Vue 2.0中的nextTick是一个异步更新DOM的方法。当我们修改响应式数据后,Vue会触发dep.notify来通知相关的watcher进行更新。在watcher对象的update方法中,如果是同步更新(sync),则直接调用run方法进行更新;如果是异步更新,则将watcher对象添加到一个队列中,等待下一个事件循环时执行更新。这样的设计可以提高Vue框架的性能,因为它将多个DOM更新操作合并为一个批量更新操作,减少了不必要的DOM操作。\[1\]\[2\]\[3\]
#### 引用[.reference_title]
- *1* *2* [Vue2.0 —— Vue.nextTick(this.$nextTick)源码探秘](https://blog.csdn.net/LizequaNNN/article/details/126957312)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v91^insert_down1,239^v3^insert_chatgpt"}} ] [.reference_item]
- *3* [Vue2.0 $nextTick源码理解](https://blog.csdn.net/denglouhen/article/details/120323058)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v91^insert_down1,239^v3^insert_chatgpt"}} ] [.reference_item]
[ .reference_list ]
阅读全文