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] 41.vue的双向绑定的原理,和angular的对比 #432

Open
qiilee opened this issue Oct 8, 2019 · 1 comment
Open

[vue] 41.vue的双向绑定的原理,和angular的对比 #432

qiilee opened this issue Oct 8, 2019 · 1 comment
Labels

Comments

@qiilee
Copy link
Member

qiilee commented Oct 8, 2019

No description provided.

@qiilee qiilee added the VUE label Oct 8, 2019
@panlee8
Copy link

panlee8 commented Mar 15, 2020

1、vue原理
数据劫持: vue.js 是采用数据劫持结合发布者-订阅者模式的方式,通过Object.defineProperty()来劫持各个属性的setter,getter,在数据变动时发布消息给订阅者,触发相应的监听回调。
2、angular原理
脏值检查:angular.js 是通过脏值检测的方式比对数据是否有变更,来决定是否更新视图,最简单的方式就是通过 setInterval() 定时轮询检测数据变动,然而angular只有在指定的事件触发时进入脏值检测。

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