Skip to content

Commit e907ffd

Browse files
committed
doc: update useInjectFormItemContext, close #5667
1 parent 18ce00d commit e907ffd

File tree

2 files changed

+6
-6
lines changed

2 files changed

+6
-6
lines changed

components/form/index.en-US.md

+3-3
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@ You can reference [Customized Form Controls](#components-form-demo-customized-fo
100100

101101
But it also has some disadvantages:
102102

103-
1. If the custom component wants Form.Item to be verified and displayed, you need to inject `const {id, onFieldChange, onFieldBlur} = useFormItemContext()` and call the corresponding method.
103+
1. If the custom component wants Form.Item to be verified and displayed, you need to inject `const {id, onFieldChange, onFieldBlur} = useInjectFormItemContext()` and call the corresponding method.
104104

105105
2. A Form.Item can only collect the data of one form item. If there are multiple form items, it will cause collection confusion, for example,
106106

@@ -122,7 +122,7 @@ The first is to use multiple `a-form-item`:
122122
</a-form-item>
123123
```
124124

125-
The second way is to wrap it with a custom component and call `useFormItemContext` in the custom component, It is equivalent to merging multiple form items into one.
125+
The second way is to wrap it with a custom component and call `useInjectFormItemContext` in the custom component, It is equivalent to merging multiple form items into one.
126126

127127
```html
128128
<script>
@@ -131,7 +131,7 @@ The second way is to wrap it with a custom component and call `useFormItemContex
131131
export default {
132132
name: 'custom-name',
133133
setup() {
134-
const formItemContext = Form.useFormItemContext();
134+
const formItemContext = Form.useInjectFormItemContext();
135135
},
136136
};
137137
</script>

components/form/index.zh-CN.md

+3-3
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@ cover: https://gw.alipayobjects.com/zos/alicdn/ORmcdeaoO/Form.svg
9999

100100
但它同样会有一些缺点:
101101

102-
1、自定义组件如果希望 Form.Item 进行校验展示,你需要 `const {id, onFieldChange, onFieldBlur} = useFormItemContext()` 注入,并调用相应的方法。
102+
1、自定义组件如果希望 Form.Item 进行校验展示,你需要 `const {id, onFieldChange, onFieldBlur} = useInjectFormItemContext()` 注入,并调用相应的方法。
103103

104104
2、一个 Form.Item 只能收集一个表单项的数据,如果有多个表单项,会导致收集错乱,例如,
105105

@@ -121,15 +121,15 @@ cover: https://gw.alipayobjects.com/zos/alicdn/ORmcdeaoO/Form.svg
121121
</a-form-item>
122122
```
123123

124-
第二种,使用自定义组件包裹,并在自定义组件中调用 `useFormItemContext`,相当于把多个表单项合并成了一个
124+
第二种,使用自定义组件包裹,并在自定义组件中调用 `useInjectFormItemContext`,相当于把多个表单项合并成了一个
125125

126126
```html
127127
<script>
128128
// 自定义组件
129129
import { Form } from 'ant-design-vue';
130130
export default {
131131
setup() {
132-
const formItemContext = Form.useFormItemContext();
132+
const formItemContext = Form.useInjectFormItemContext();
133133
},
134134
};
135135
</script>

0 commit comments

Comments
 (0)