Jingsong Gao
5 years ago
committed by
GitHub
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with
19 additions and
29 deletions
components/form/v3.en-US.md
components/form/v3.zh-CN.md
@ -112,7 +112,7 @@ class Demo extends React.Component {
}
```
If you don't want to use the Item style, you can use `i nlin e` prop to remove it:
If you don't want to use the Item style, you can use `noSty le` prop to remove it:
```jsx
// antd v3
@ -269,19 +269,14 @@ Nested field definition has changed from:
```jsx
// antd v3
< Form.Item label = "Firstname" >
{getFieldDecorator("user.0.firstname", {})(< Input / > )}
< / Form.Item >
< Form.Item label = "Firstname" > {getFieldDecorator('user.0.firstname', {})(< Input / > )}< / Form.Item >
```
To
To
```jsx
// antd v4
< Form.Item
name={['user', '0', 'firstname']}
label="Firstname"
>
< Form.Item name = {['user', ' 0 ' , ' firstname ' ] } label = "Firstname" >
< Input / >
< / Form.Item >
```
@ -291,7 +286,7 @@ Similarly using `setFieldsValue` has changed from:
```jsx
// antd v3
this.formRef.current.setFieldsValue({
'user.0.firstname': 'John'
'user.0.firstname': 'John',
});
```
@ -300,14 +295,14 @@ To
```jsx
// antd v4
this.formRef.current.setFieldsValue({
user:
[{
firstname: 'John'
}]
user: [
{
firstname: 'John',
},
],
});
```
### Remove callback in validateFields
`validateFields` will return a Promise, so you can handle the error with `async/await` or `then/catch` . It is no longer necessary to determine if `errors` is empty:
@ -114,7 +114,7 @@ class Demo extends React.Component {
}
```
由于 Form.Item 内置字段绑定,如果需要不带样式的表单绑定,可以使用 `i nlin e` 属性移除额外样式:
由于 Form.Item 内置字段绑定,如果需要不带样式的表单绑定,可以使用 `noSty le` 属性移除额外样式:
```jsx
// antd v3
@ -267,24 +267,18 @@ form.getFieldsError();
*/
```
嵌套字段定义由:
```jsx
// antd v3
< Form.Item label = "Firstname" >
{getFieldDecorator("user.0.firstname", {})(< Input / > )}
< / Form.Item >
< Form.Item label = "Firstname" > {getFieldDecorator('user.0.firstname', {})(< Input / > )}< / Form.Item >
```
改至:
```jsx
// antd v4
< Form.Item
name={['user', '0', 'firstname']}
label="Firstname"
>
< Form.Item name = {['user', ' 0 ' , ' firstname ' ] } label = "Firstname" >
< Input / >
< / Form.Item >
```
@ -294,7 +288,7 @@ form.getFieldsError();
```jsx
// antd v3
this.formRef.current.setFieldsValue({
'user.0.firstname': 'John'
'user.0.firstname': 'John',
});
```
@ -303,10 +297,11 @@ this.formRef.current.setFieldsValue({
```jsx
// antd v4
this.formRef.current.setFieldsValue({
user:
[{
firstname: 'John'
}]
user: [
{
firstname: 'John',
},
],
});
```