Scenario description
1. Wrap the cascade component twice
2. Use it in the news list editing function. The editing function is to pop up a form box that mimics the box
Problem description
Every time you click on any of the pop-up pseudo-box forms for editing, select any value in the cascade component inside, then click to close the editing pseudo-box, and then click on any piece of news When editing, the pop-up simulation box will display the undetermined submitted value of the last selection by default.
Tried methods
Used the form reset methodresetFields
The value in the cascading box cannot be cleared. I found some posts in antd's github and the attempts are still invalid. I learned from one of the posts that https://github.com/ant-design... resetFields
is reset and cannot be cleared.
Ideal goal
Every time I click edit, I want to force clear the value inside.
Thank you everyone~!
PHP中文网2017-05-19 10:38:29
I don’t know if the questioner used antd Form
和 Form.item
?如果是的话,antd 是使用了“高阶函数”的方式封装了 Form.Item
,并将级联的 value
和 Form.Item
的 initialValue
或 value
(好吧,我也记不清了...) 关联了,二次封装的话,应该使用相应的 this.props.value
来控制封装逐渐内部的 value
.
大家讲道理2017-05-19 10:38:29
I haven’t seen your code, so I don’t know how you implemented it, but the simplest way is to bind the value and state of your component. When you want to clear the value of the component, just reset the setState.