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

父子组件传值,页面更新后,未触发子组件 $attrs 更新,更新值流转到了 $props 上 #5016

Closed
Hubmeat opened this issue Nov 29, 2021 · 0 comments · Fixed by #5017
Labels
❗ p4-important Priority 4: this fixes bugs that violate documented behavior, or significantly improves perf. 🐞 bug Something isn't working

Comments

@Hubmeat
Copy link

Hubmeat commented Nov 29, 2021

Version

3.2.22

Reproduction link

sfc.vuejs.org/

Steps to reproduce

父子组件传值,子组件声明 attr 并且初始值是 underfined
此时,更新 attr, 子组件 $attrs 并未收到更新,发现此时的更新进入 $props 中(并未在子组件中,声明改 attr 为 prop 属性)

排查发现:
updateProps 会在 _hmrId 为 underfined 时,把 attribute 设置到 $porps 中

What is expected?

期望 $attrs 更新,而不是 $porps 更新

What is actually happening?

$attrs 未更新,prop 进入 $porps 且转换为驼峰规则

@Hubmeat Hubmeat changed the title 默认 attr 如果赋值 underfined, 当 __hmrId 是 underfined 时, 页面更新后,未触发 $attrs 更新 父子组件传值,页面更新后,未触发子组件 $attrs 更新,更新值流转到了 $props 上 Nov 29, 2021
@edison1105 edison1105 added the 🐞 bug Something isn't working label Nov 29, 2021
@posva posva added the ❗ p4-important Priority 4: this fixes bugs that violate documented behavior, or significantly improves perf. label Nov 30, 2021
@github-actions github-actions bot locked and limited conversation to collaborators Oct 7, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
❗ p4-important Priority 4: this fixes bugs that violate documented behavior, or significantly improves perf. 🐞 bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants