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没有提供对数组属性的监听 #8562

Closed
hfhan opened this issue Jul 27, 2018 · 4 comments
Closed

为什么vue没有提供对数组属性的监听 #8562

hfhan opened this issue Jul 27, 2018 · 4 comments

Comments

@hfhan
Copy link

hfhan commented Jul 27, 2018

What problem does this feature solve?

在vue中,通过Object.defineProperty实现了对对象属性的监听,但是Object.defineProperty对数组已有元素也是实现监听的,那么为什么vue中没有提供这一功能,使得arr[已有元素下标]=val变成响应式?

具体分析:https://segmentfault.com/a/1190000015783546?_ea=4074035

What does the proposed API look like?


@yyx990803
Copy link
Member

yyx990803 commented Jul 27, 2018

要求写得很清楚,不要用 issue 问问题。

看你的文章研究得挺有热情,破例回答一下:就是因为性能问题。

@hfhan
Copy link
Author

hfhan commented Jul 27, 2018

尤大,我想问下究竟是什么样的性能问题限制了这一功能呢?因为现代浏览器以及电脑配置都还不错,监测几万乃至几十万个属性应该还是可以的,如果数组长度被限制,是不是就可以使用这一功能了?

@yyx990803
Copy link
Member

性能代价和获得的用户体验收益不成正比。

@hfhan
Copy link
Author

hfhan commented Jul 27, 2018

谢谢尤大,明白了。(◦˙▽˙◦)

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