docs: Add FAQ about Form.Item name array rule

close #25508
This commit is contained in:
zombiej 2020-07-08 23:00:35 +08:00
parent 260d40dffb
commit 0b7271767e
2 changed files with 8 additions and 0 deletions

View File

@ -310,6 +310,10 @@ validator(rule, value, callback) => {
} }
``` ```
### How does name fill value when it's array?
`name` will fill value by array order. When there exists number in it and no related field in form store, it will auto convert field to array. If you want to keep it as object, use string like: `['1', ''name]`.
### Why is there a form warning when used in Modal? ### Why is there a form warning when used in Modal?
> Warning: Instance created by `useForm` is not connect to any Form element. Forget to pass `form` prop? > Warning: Instance created by `useForm` is not connect to any Form element. Forget to pass `form` prop?

View File

@ -311,6 +311,10 @@ validator(rule, value, callback) => {
} }
``` ```
### name 为数组使的转换规则?
`name` 为数组时,会按照顺序填充路径。当存在数字且 form store 中没有该字段时会自动转变成数组。因而如果需要数组为 key 时请使用 string 如:`['1', ''name]`。
### 为何在 Modal 中调用 form 控制台会报错? ### 为何在 Modal 中调用 form 控制台会报错?
> Warning: Instance created by `useForm` is not connect to any Form element. Forget to pass `form` prop? > Warning: Instance created by `useForm` is not connect to any Form element. Forget to pass `form` prop?