doc: update
parent
cb3c002e17
commit
648ab4c4b9
|
@ -19,7 +19,7 @@ Controls must injects `useInjectFormItemContext` and calls the corresponding met
|
|||
<template>
|
||||
<a-form name="customized_form_controls" layout="inline" :model="formState" @finish="onFinish">
|
||||
<a-form-item name="price" label="Price" :rules="[{ validator: checkPrice }]">
|
||||
<PriceInput v-model:value="formState.price" />
|
||||
<price-input v-model:value="formState.price" />
|
||||
</a-form-item>
|
||||
<a-form-item>
|
||||
<a-button type="primary" html-type="submit">Submit</a-button>
|
||||
|
@ -28,6 +28,7 @@ Controls must injects `useInjectFormItemContext` and calls the corresponding met
|
|||
</template>
|
||||
<script lang="ts">
|
||||
import { defineComponent, reactive } from 'vue';
|
||||
// sorceCode https://github.com/vueComponent/ant-design-vue/blob/cb3c002e17f0f4f5b3e8d01846069da0e2645aff/components/form/demo/price-input.vue
|
||||
import PriceInput from './price-input.vue';
|
||||
import type { Currency } from './price-input.vue';
|
||||
|
||||
|
|
|
@ -94,7 +94,7 @@ You can reference [Customized Form Controls](#components-form-demo-customized-fo
|
|||
|
||||
But it also has some disadvantages:
|
||||
|
||||
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.
|
||||
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.
|
||||
|
||||
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,
|
||||
|
||||
|
|
|
@ -93,7 +93,7 @@ cover: https://gw.alipayobjects.com/zos/alicdn/ORmcdeaoO/Form.svg
|
|||
|
||||
但它同样会有一些缺点:
|
||||
|
||||
1、自定义组件如果希望 Form.Item 进行校验展示,你需要 `const {id, onFieldChange, onFieldBlur} = useFormItemContext` 注入,并调用相应的方法。
|
||||
1、自定义组件如果希望 Form.Item 进行校验展示,你需要 `const {id, onFieldChange, onFieldBlur} = useFormItemContext()` 注入,并调用相应的方法。
|
||||
|
||||
2、一个 Form.Item 只能收集一个表单项的数据,如果有多个表单项,会导致收集错乱,例如,
|
||||
|
||||
|
|
Loading…
Reference in New Issue