diff --git a/src/components/Form/src/BasicForm.vue b/src/components/Form/src/BasicForm.vue index d6416ee68..68e9fa907 100644 --- a/src/components/Form/src/BasicForm.vue +++ b/src/components/Form/src/BasicForm.vue @@ -174,7 +174,7 @@ updateSchema, resetSchema, appendSchemaByField, - removeSchemaByFiled, + removeSchemaByFeild, resetFields, scrollToField, } = useFormEvents({ @@ -268,7 +268,7 @@ updateSchema, resetSchema, setProps, - removeSchemaByFiled, + removeSchemaByFeild, appendSchemaByField, clearValidate, validateFields, diff --git a/src/components/Form/src/hooks/useForm.ts b/src/components/Form/src/hooks/useForm.ts index d026d690d..55da9890d 100644 --- a/src/components/Form/src/hooks/useForm.ts +++ b/src/components/Form/src/hooks/useForm.ts @@ -79,8 +79,8 @@ export function useForm(props?: Props): UseFormReturnType { }); }, - removeSchemaByFiled: async (field: string | string[]) => { - unref(formRef)?.removeSchemaByFiled(field); + removeSchemaByFeild: async (field: string | string[]) => { + unref(formRef)?.removeSchemaByFeild(field); }, // TODO promisify diff --git a/src/components/Form/src/hooks/useFormEvents.ts b/src/components/Form/src/hooks/useFormEvents.ts index 4fa96bc47..28f8cfd01 100644 --- a/src/components/Form/src/hooks/useFormEvents.ts +++ b/src/components/Form/src/hooks/useFormEvents.ts @@ -112,7 +112,7 @@ export function useFormEvents({ /** * @description: Delete based on field name */ - async function removeSchemaByFiled(fields: string | string[]): Promise { + async function removeSchemaByFeild(fields: string | string[]): Promise { const schemaList: FormSchema[] = cloneDeep(unref(getSchema)); if (!fields) { return; @@ -123,7 +123,7 @@ export function useFormEvents({ fieldList = [fields]; } for (const field of fieldList) { - _removeSchemaByFiled(field, schemaList); + _removeSchemaByFeild(field, schemaList); } schemaRef.value = schemaList; } @@ -131,7 +131,7 @@ export function useFormEvents({ /** * @description: Delete based on field name */ - function _removeSchemaByFiled(field: string, schemaList: FormSchema[]): void { + function _removeSchemaByFeild(field: string, schemaList: FormSchema[]): void { if (isString(field)) { const index = schemaList.findIndex((schema) => schema.field === field); if (index !== -1) { @@ -306,7 +306,7 @@ export function useFormEvents({ updateSchema, resetSchema, appendSchemaByField, - removeSchemaByFiled, + removeSchemaByFeild, resetFields, setFieldsValue, scrollToField, diff --git a/src/components/Form/src/types/form.ts b/src/components/Form/src/types/form.ts index 2c772286a..f7d997479 100644 --- a/src/components/Form/src/types/form.ts +++ b/src/components/Form/src/types/form.ts @@ -33,7 +33,7 @@ export interface FormActionType { updateSchema: (data: Partial | Partial[]) => Promise; resetSchema: (data: Partial | Partial[]) => Promise; setProps: (formProps: Partial) => Promise; - removeSchemaByFiled: (field: string | string[]) => Promise; + removeSchemaByFeild: (field: string | string[]) => Promise; appendSchemaByField: ( schema: FormSchema, prefixField: string | undefined, diff --git a/src/views/demo/form/AppendForm.vue b/src/views/demo/form/AppendForm.vue index eda618786..7722e120a 100644 --- a/src/views/demo/form/AppendForm.vue +++ b/src/views/demo/form/AppendForm.vue @@ -21,7 +21,7 @@ export default defineComponent({ components: { BasicForm, CollapseContainer, PageWrapper, [Input.name]: Input, Button }, setup() { - const [register, { appendSchemaByField, removeSchemaByFiled, validate }] = useForm({ + const [register, { appendSchemaByField, removeSchemaByFeild, validate }] = useForm({ schemas: [ { field: 'field0a', @@ -108,7 +108,7 @@ } function del(field) { - removeSchemaByFiled([`field${field}a`, `field${field}b`, `${field}`]); + removeSchemaByFeild([`field${field}a`, `field${field}b`, `${field}`]); n.value--; } diff --git a/src/views/demo/form/DynamicForm.vue b/src/views/demo/form/DynamicForm.vue index 08fa8ab56..922bf0841 100644 --- a/src/views/demo/form/DynamicForm.vue +++ b/src/views/demo/form/DynamicForm.vue @@ -181,7 +181,7 @@ export default defineComponent({ components: { BasicForm, CollapseContainer, PageWrapper }, setup() { - const [register, { setProps, updateSchema, appendSchemaByField, removeSchemaByFiled }] = + const [register, { setProps, updateSchema, appendSchemaByField, removeSchemaByFeild }] = useForm({ labelWidth: 120, schemas, @@ -229,7 +229,7 @@ ); } function deleteField() { - removeSchemaByFiled('field11'); + removeSchemaByFeild('field11'); } return { register,