Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

vue 里面对 data 里面的 name 属性设置 this.name=1,this.name=2,视图会更新几次 #2

Open
Sean529 opened this issue Nov 10, 2022 · 1 comment
Labels

Comments

@Sean529
Copy link

Sean529 commented Nov 10, 2022

更新一次
vue 是异步执行 dom 更新的,一旦观察到数据变化,vue 就会开启一个队列,然后把在同一事件循环当中观察到数据变化的 watcher 推送进这个队列,如果这个 watcher 被触发多次,只会被推送到队列一次,这种缓存行为可以有效的去掉重复数据造成的不必要的计算和dom 操作,这样可以提高渲染效率。

@nmsn nmsn added the Vue label Nov 10, 2022
@nmsn
Copy link
Contributor

nmsn commented Nov 10, 2022

原文: 异步更新队列

只要侦听到数据变化,Vue 将开启一个队列,并缓冲在同一事件循环中发生的所有数据变更。如果同一个 watcher 被多次触发,只会被推入到队列中一次。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants