mirror of
https://github.com/ant-design/ant-design.git
synced 2024-11-28 13:09:40 +08:00
docs: Update Form FAQ (#23138)
* docs: Update Form FAQ * Update index.en-US.md
This commit is contained in:
parent
bfd5d7c910
commit
50d908662e
@ -312,6 +312,10 @@ Before Modal open, children elements do not exist in the view. You can set `forc
|
||||
|
||||
Components inside Form.Item with name property will turn into controlled mode, that makes `defaultValue` does not work anymore. Please try `initialValues` of Form to set default value.
|
||||
|
||||
### Why resetFields will re-mount component?
|
||||
|
||||
`resetFields` will re-mount component under Field to clean up customize component side effect(like asyn data, cached state, etc.). It's by design.
|
||||
|
||||
<style>
|
||||
.site-form-item-icon {
|
||||
color: rgba(0, 0, 0, 0.25);
|
||||
|
@ -313,6 +313,10 @@ validator(rule, value, callback) => {
|
||||
|
||||
当你为 Form.Item 设置 `name` 属性后,子组件会转为受控模式。因而 `defaultValue` 不会生效。你需要在 Form 上通过 `initialValues` 设置默认值。
|
||||
|
||||
### 为什么 resetFields 会重新 mount 组件?
|
||||
|
||||
`resetFields` 会重置整个 Field,因而其子组件也会重新 mount 从而消除自定义组件可能存在的副作用(例如异步数据、状态等等)。
|
||||
|
||||
<style>
|
||||
.site-form-item-icon {
|
||||
color: rgba(0, 0, 0, 0.25);
|
||||
|
Loading…
Reference in New Issue
Block a user