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 无法监听 Set 和 Map 类型元素的添加和删除 #12197

Closed
elewen opened this issue Jul 28, 2021 · 2 comments
Closed

Vue 无法监听 Set 和 Map 类型元素的添加和删除 #12197

elewen opened this issue Jul 28, 2021 · 2 comments

Comments

@elewen
Copy link

elewen commented Jul 28, 2021

What problem does this feature solve?

希望页面对 Set 及 Map 遍历时如果添加或删除了元素,页面能实时更新dom节点。

What does the proposed API look like?

希望页面对 Set 及 Map 遍历时如果添加或删除了元素,页面能实时更新dom节点。

@elewen
Copy link
Author

elewen commented Jul 28, 2021

虽然 $forceUpdate 可以强制更新,但是仅限于 Set 或 Map 来自同一个 Component。如果Set 或 Map 来自 props 或 store,还是没有合适的时机在组件内执行 $forceUpdate,除非 boardcast 一个事件或者额外通过目标组件的引用去调用一个更新的方法,但这也太麻烦了,后期会很难维护。

@Justineo
Copy link
Member

Duplicate of #6774

@Justineo Justineo marked this as a duplicate of #6774 Jul 28, 2021
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