Skip to content

Commit 8a17318

Browse files
committed
docs: update form doc
1 parent f4615c8 commit 8a17318

File tree

2 files changed

+10
-10
lines changed

2 files changed

+10
-10
lines changed

components/form/index.en-US.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ The following `options` are available:
5454

5555
If the form has been decorated by `Form.create` then it has `this.form` property. `this.form` provides some APIs as follows:
5656

57-
> Note: Before using `getFieldsValue` `getFieldValue` `setFieldsValue` and so on, please make sure that corresponding field had been registered with `getFieldDecorator`.
57+
> Note: Before using `getFieldsValue` `getFieldValue` `setFieldsValue` and so on, please make sure that corresponding field had been registered with `getFieldDecorator` or `v-decorator`.
5858
5959
| Method | Description | Type |
6060
| ------ | ----------- | ---- |
@@ -63,8 +63,8 @@ If the form has been decorated by `Form.create` then it has `this.form` property
6363
| getFieldsError | Get the specified fields' error. If you don't specify a parameter, you will get all fields' error. | Function(\[names: string\[]]) |
6464
| getFieldsValue | Get the specified fields' values. If you don't specify a parameter, you will get all fields' values. | Function(\[fieldNames: string\[]]) |
6565
| getFieldValue | Get the value of a field. | Function(fieldName: string) |
66-
| isFieldsTouched | Check whether any of fields is touched by `getFieldDecorator`'s `options.trigger` event | (names?: string\[]) => boolean |
67-
| isFieldTouched | Check whether a field is touched by `getFieldDecorator`'s `options.trigger` event | (name: string) => boolean |
66+
| isFieldsTouched | Check whether any of fields is touched by `getFieldDecorator`'s or `v-decorator`'s `options.trigger` event | (names?: string\[]) => boolean |
67+
| isFieldTouched | Check whether a field is touched by `getFieldDecorator`'s or `v-decorator`'s `options.trigger` event | (name: string) => boolean |
6868
| isFieldValidating | Check if the specified field is being validated. | Function(name) |
6969
| resetFields | Reset the specified fields' value(to `initialValue`) and status. If you don't specify a parameter, all the fields will be reset. | Function(\[names: string\[]]) |
7070
| setFields | Set value and error state of fields. | ({<br />&nbsp;&nbsp;\[fieldName\]: {value: any, errors: \[Error\] }<br />}) => void |
@@ -137,7 +137,7 @@ To mark the returned fields data in `mapPropsToFields`, [demo](#components-form-
137137
After wrapped by `getFieldDecorator` or `v-decorator`, `value`(or other property defined by `valuePropName`) `onChange`(or other property defined by `trigger`) props will be added to form controls,the flow of form data will be handled by Form which will cause:
138138

139139
1. You shouldn't use `onChange` to collect data, but you still can listen to `onChange`(and so on) events.
140-
2. You cannot set value of form control via `value` `defaultValue` prop, and you should set default value with `initialValue` in `getFieldDecorator` instead.
140+
2. You cannot set value of form control via `value` `defaultValue` prop, and you should set default value with `initialValue` in `getFieldDecorator` or `v-decorator` instead.
141141
3. You shouldn't call `v-model` manually, please use `this.form.setFieldsValue` to change value programmatically.
142142

143143
#### Special attention

components/form/index.zh-CN.md

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ export default {
5252

5353
经过 `Form.create` 包装的组件将会自带 `this.form` 属性,`this.form` 提供的 API 如下:
5454

55-
> 注意:使用 `getFieldsValue` `getFieldValue` `setFieldsValue` 等时,应确保对应的 field 已经用 `getFieldDecorator` 注册过了。
55+
> 注意:使用 `getFieldsValue` `getFieldValue` `setFieldsValue` 等时,应确保对应的 field 已经用 `getFieldDecorator` `v-decorator` 注册过了。
5656
5757
| 方法      | 说明                                     | 类型       |
5858
| ------- | -------------------------------------- | -------- |
@@ -61,8 +61,8 @@ export default {
6161
| getFieldsError | 获取一组输入控件的 Error ,如不传入参数,则获取全部组件的 Error | Function(\[names: string\[]]) |
6262
| getFieldsValue | 获取一组输入控件的值,如不传入参数,则获取全部组件的值 | Function(\[fieldNames: string\[]]) |
6363
| getFieldValue | 获取一个输入控件的值 | Function(fieldName: string) |
64-
| isFieldsTouched | 判断是否任一输入控件经历过 `getFieldDecorator` 的值收集时机 `options.trigger` | (names?: string\[]) => boolean |
65-
| isFieldTouched | 判断一个输入控件是否经历过 `getFieldDecorator` 的值收集时机 `options.trigger` | (name: string) => boolean |
64+
| isFieldsTouched | 判断是否任一输入控件经历过 `getFieldDecorator` `v-decorator` 的值收集时机 `options.trigger` | (names?: string\[]) => boolean |
65+
| isFieldTouched | 判断一个输入控件是否经历过 `getFieldDecorator` `v-decorator` 的值收集时机 `options.trigger` | (name: string) => boolean |
6666
| isFieldValidating | 判断一个输入控件是否在校验状态 | Function(name) |
6767
| resetFields | 重置一组输入控件的值(为 `initialValue`)与状态,如不传入参数,则重置所有组件 | Function(\[names: string\[]]) |
6868
| setFields | 设置一组输入控件的值与错误状态。 | Function({ [fieldName]&#x3A; { value: any, errors: [Error] } }) |
@@ -136,13 +136,13 @@ validateFields(['field1', 'field2'], options, (errors, values) => {
136136
经过 `getFieldDecorator``v-decorator` 包装的控件,表单控件会自动添加 `value`(或 `valuePropName` 指定的其他属性) `onChange`(或 `trigger` 指定的其他属性),数据同步将被 Form 接管,这会导致以下结果:
137137

138138
1.**不再需要也不应该**`onChange` 来做同步,但还是可以继续监听 `onChange` 等事件。
139-
2. 你不能用控件的 `value` `defaultValue` 等属性来设置表单域的值,默认值可以用 `getFieldDecorator` 里的 `initialValue`
139+
2. 你不能用控件的 `value` `defaultValue` 等属性来设置表单域的值,默认值可以用 `getFieldDecorator` `v-decorator` 里的 `initialValue`
140140
3. 你不应该用 `v-model`,可以使用 `this.form.setFieldsValue` 来动态改变表单值。
141141

142142
#### 特别注意
143143

144-
1. `getFieldDecorator``v-decorator` 不能用于装饰纯函数组件。
145-
2. `getFieldDecorator``v-decorator` 调用不能位于纯函数组件中 <https://cn.vuejs.org/v2/api/#functional>
144+
1. `getFieldDecorator``v-decorator` 不能用于装饰纯函数组件。
145+
2. `getFieldDecorator``v-decorator` 调用不能位于纯函数组件中 <https://cn.vuejs.org/v2/api/#functional>
146146

147147
#### getFieldDecorator(id, options) 和 v-decorator="[id, options]" 参数
148148

0 commit comments

Comments
 (0)