docs: correct inline to noStyle (#22029)

This commit is contained in:
Jingsong Gao 2020-03-09 17:55:22 +08:00 committed by GitHub
parent 28c06266d0
commit 6d48c131dc
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 19 additions and 29 deletions

View File

@ -112,7 +112,7 @@ class Demo extends React.Component {
}
```
If you don't want to use the Item style, you can use `inline` prop to remove it:
If you don't want to use the Item style, you can use `noStyle` 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:

View File

@ -114,7 +114,7 @@ class Demo extends React.Component {
}
```
由于 Form.Item 内置字段绑定,如果需要不带样式的表单绑定,可以使用 `inline` 属性移除额外样式:
由于 Form.Item 内置字段绑定,如果需要不带样式的表单绑定,可以使用 `noStyle` 属性移除额外样式:
```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',
},
],
});
```