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

defaultValue 和 value 的 不同步 #26

Open
monkey-gxp opened this issue Apr 19, 2022 · 2 comments
Open

defaultValue 和 value 的 不同步 #26

monkey-gxp opened this issue Apr 19, 2022 · 2 comments

Comments

@monkey-gxp
Copy link

monkey-gxp commented Apr 19, 2022

example: 我有多个tab切换,每个tab用的均为同样的组件,切换tab只是传对应的props到该组件,虽然console.log(props)为不同的内容,但是 编辑器中的文本为上一个加载后的内容,而不是新传入的 props。 初步判断,应该是defalutValue 导致,在组件加载渲染后,重新传入参数,并没有更改掉defaultValue。 使用value可能会解决该问题

@dongggcom
Copy link
Owner

可以通过卸载,例如 visiable && <Compoent />

@monkey-gxp
Copy link
Author

如果这样的话,岂不是同一个组件多次引入?为何不复用呢?

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