admin管理员组文章数量:1434030
If I inspect a computed property in Vue 2.7, I can see that, besides the well-known .value
property, there's also .effect
. I wasn't able to find any information about it, except that it's deprecated in Vue 3. Does anybody know why it was needed and what its use was? Why has it become deprecated? I'd also appreciate, if somebody shares a link to the page where this property would be documented.
If I inspect a computed property in Vue 2.7, I can see that, besides the well-known .value
property, there's also .effect
. I wasn't able to find any information about it, except that it's deprecated in Vue 3. Does anybody know why it was needed and what its use was? Why has it become deprecated? I'd also appreciate, if somebody shares a link to the page where this property would be documented.
- Looks like it's an old API that was considered when migrating towards the v3. Was probably deprecated in favor of watchEffect. – kissu Commented Nov 18, 2024 at 14:46
1 Answer
Reset to default 1It's an undocumented API for internal purposes that contains a watcher that updates the computed value:
some libs rely on the presence effect for checking computed refs from normal refs, but the implementation doesn't matter
This seems plausible, because in Vue 3 computed and other special kinds of refs have internal properties that make them different from regular refs, but they don't exist in Vue 2 reactivity API.
In Vue itself, it's used for testing.
本文标签: vuejsWhat is 39effect39 on Vue computed propertiesStack Overflow
版权声明:本文标题:vue.js - What is 'effect' on Vue computed properties - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1745612245a2666181.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论