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

🧐[问题]ProFormDateTimePicker怎么设置成受控组件,我需要 #8807

Open
huangnan20030709 opened this issue Oct 18, 2024 · 5 comments

Comments

@huangnan20030709
Copy link

提问前先看看:

https://github.com/ryanhanwu/How-To-Ask-Questions-The-Smart-Way/blob/main/README-zh_CN.md

🧐 问题描述

💻 示例代码

🚑 其他信息

@huangnan20030709 huangnan20030709 changed the title 🧐[问题]ProFormDateTimePicker怎么给 🧐[问题]ProFormDateTimePicker怎么设置成受控组件,我需要 Oct 18, 2024
@fnoopv
Copy link
Contributor

fnoopv commented Oct 22, 2024

自己封装一个就是了

@huangnan20030709
Copy link
Author

主要是这个组件给传prop一个状态不管用啊,下一次渲染value值,它不会重新更新

@fnoopv
Copy link
Contributor

fnoopv commented Oct 22, 2024

一个扁担组件只要有valueonChange两个字段就行了,我封装过,没问题的啊

@huangnan20030709
Copy link
Author

没问题的吗,这么奇怪,我再看看,谢谢大佬

@fnoopv
Copy link
Contributor

fnoopv commented Oct 22, 2024

想了一下,虽然不知道你为啥要表单组件受控,但是应该有两种方法。1是自己封装,然后在Form.Item里面包裹就行了,封装的组件需要提供value和onChange两个属性,2,使用表单的onValuesChange方法,能拿到表单的所有字段值,然后用formRef去设置字段值,这个应该更简单

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