mirror of
https://github.com/ant-design/ant-design.git
synced 2025-06-07 17:44:35 +08:00
docs: Add instruction about validateFields arguments, close #11084
This commit is contained in:
parent
31014e94ba
commit
d88a8f6920
@ -99,6 +99,40 @@ If the form has been decorated by `Form.create` then it has `this.props.form` pr
|
||||
| options.force | Should validate validated field again when `validateTrigger` is been triggered again | boolean | false |
|
||||
| options.scroll | Config scroll behavior of `validateFieldsAndScroll`, more: [dom-scroll-into-view's config](https://github.com/yiminghe/dom-scroll-into-view#function-parameter) | Object | {} |
|
||||
|
||||
#### Callback arguments example of validateFields
|
||||
|
||||
- `errors`:
|
||||
|
||||
```js
|
||||
{
|
||||
"userName": {
|
||||
"errors": [
|
||||
{
|
||||
"message": "Please input your username!",
|
||||
"field": "userName"
|
||||
}
|
||||
]
|
||||
},
|
||||
"password": {
|
||||
"errors": [
|
||||
{
|
||||
"message": "Please input your Password!",
|
||||
"field": "password"
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
- `values`:
|
||||
|
||||
```js
|
||||
{
|
||||
"userName": "username",
|
||||
"password": "password",
|
||||
}
|
||||
```
|
||||
|
||||
### Form.createFormField
|
||||
|
||||
To mark the returned fields data in `mapPropsToFields`, [demo](#components-form-demo-global-state).
|
||||
|
@ -100,6 +100,41 @@ this.form // => The instance of CustomizedForm
|
||||
| options.force | 对已经校验过的表单域,在 validateTrigger 再次被触发时是否再次校验 | boolean | false |
|
||||
| options.scroll | 定义 validateFieldsAndScroll 的滚动行为,详细配置见 [dom-scroll-into-view config](https://github.com/yiminghe/dom-scroll-into-view#function-parameter) | Object | {} |
|
||||
|
||||
#### validateFields 的 callback 参数示例
|
||||
|
||||
- `errors`:
|
||||
|
||||
```js
|
||||
{
|
||||
"userName": {
|
||||
"errors": [
|
||||
{
|
||||
"message": "Please input your username!",
|
||||
"field": "userName"
|
||||
}
|
||||
]
|
||||
},
|
||||
"password": {
|
||||
"errors": [
|
||||
{
|
||||
"message": "Please input your Password!",
|
||||
"field": "password"
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
- `values`:
|
||||
|
||||
```js
|
||||
{
|
||||
"userName": "username",
|
||||
"password": "password",
|
||||
}
|
||||
```
|
||||
|
||||
|
||||
### Form.createFormField
|
||||
|
||||
用于标记 `mapPropsToFields` 返回的表单域数据,[例子](#components-form-demo-global-state)。
|
||||
|
Loading…
Reference in New Issue
Block a user