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] 说说你对proxy的理解 #359

Open
haizhilin2013 opened this issue Jun 20, 2019 · 2 comments
Open

[vue] 说说你对proxy的理解 #359

haizhilin2013 opened this issue Jun 20, 2019 · 2 comments
Labels
vue vue

Comments

@haizhilin2013
Copy link
Collaborator

[vue] 说说你对proxy的理解

@haizhilin2013 haizhilin2013 added the vue vue label Jun 20, 2019
@Myh-cs
Copy link

Myh-cs commented Jul 9, 2019

目前只知道用来修改 属性的get set方法 vue3 来替换Object.defineProperty。一方面提高性能 另一方面可以免去给数组重写方法。

@xiaoliuer
Copy link

vue的数据劫持有两个缺点:
1、无法监听通过索引修改数组的值的变化
2、无法监听object也就是对象的值的变化
所以vue2.x中才会有$set属性的存在

proxy是es6中推出的新api,可以弥补以上两个缺点,所以vue3.x版本用proxy替换object.defineproperty

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

No branches or pull requests

3 participants