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

精读《设计模式 - Proxy 代理模式》 #291

Closed
ascoders opened this issue Dec 20, 2020 · 1 comment
Closed

精读《设计模式 - Proxy 代理模式》 #291

ascoders opened this issue Dec 20, 2020 · 1 comment

Comments

@ascoders
Copy link
Owner

ascoders commented Dec 20, 2020

代理模式是指利用访问代理的方式,代替访问原始对象。这种模式有很多使用场景,比如对已有对象做增强、做按需初始化等等。


精读《设计模式 - Proxy 代理模式》

@CommanderXL
Copy link

这2天阅读了下 @vue/composition-api 的代码了解了下 vue 组合式的 api 对于 vue2.x 的兼容,里面也是使用代理模式的场景非常多。

例如 reactiveref 等响应式的 api,是在原本已经改造后的响应式数据的基础上再做一层代理,既保证了通过响应式 api 改造后数据的响应特性,同时还满足了原本所具备的双向数据绑定的机制。

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

No branches or pull requests

2 participants