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

[FormItem] FormItem组件会用自己的缺省值覆盖用户的props,导致初始化时丢失用户原来的状态 #2804

Open
broxiang opened this issue Mar 16, 2024 · 4 comments
Labels
💭 discussion we are discussing usage

Comments

@broxiang
Copy link

broxiang commented Mar 16, 2024

tdesign-react 版本

1.5.3

重现链接

https://codesandbox.io/p/sandbox/formitem-khwfg8

重现步骤

image image

** 源码捞出来在本地测试的结果:**
image
image
image
image

最简单的案例
image
image

期望结果

不要影响用户的原始表单状态

实际结果

实际结果是用户状态被覆盖了

框架版本

No response

浏览器版本

No response

系统版本

No response

Node版本

No response

补充说明

解决办法已经贴图里了,亲测有效~

Copy link
Contributor

👋 @broxiang,感谢给 TDesign 提出了 issue。
请根据 issue 模版确保背景信息的完善,我们将调查并尽快回复你。

@HaixingOoO
Copy link
Collaborator

HaixingOoO commented Mar 16, 2024

@broxiang 地址:https://tdesign.tencent.com/react/components/form?tab=demo#faq
image

@broxiang
Copy link
Author

broxiang commented Mar 16, 2024

@HaixingOoO 这种办法虽然是能解决一部分问题,但是感觉这种设计略微不太合理,用initialData貌似解决不了一个FormItem中包裹多个Input的场景(每个Input的初始值不同),包括文档下面提到的只想用Form来布局的场景,也必须要在内部套一层div,不然也没办法达到纯净的布局作用,这个设计有些侵入业务,略微超出了UI组件的职责范畴(假设是存量系统做迁移,这种也是一种阻力),是否可以考虑增加一个控制属性来关掉这个特性呢~

image image image

@HaixingOoO
Copy link
Collaborator

@broxiang 我们讨论一下,感谢!!!

@HaixingOoO HaixingOoO added the 💭 discussion we are discussing label Mar 16, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
💭 discussion we are discussing usage
Projects
None yet
Development

No branches or pull requests

2 participants