Commit 6b594aec5397cda80c57305ce203bce17929fc0c

Authored by lzdjack
Committed by GitHub
1 parent fa33c6b0

fix: Fix the issue that clear verification does not take effect in the reset form (#1498)

src/components/Form/src/hooks/useFormEvents.ts
1 import type { ComputedRef, Ref } from 'vue'; 1 import type { ComputedRef, Ref } from 'vue';
2 import type { FormProps, FormSchema, FormActionType } from '../types/form'; 2 import type { FormProps, FormSchema, FormActionType } from '../types/form';
3 import type { NamePath } from 'ant-design-vue/lib/form/interface'; 3 import type { NamePath } from 'ant-design-vue/lib/form/interface';
4 -import { unref, toRaw } from 'vue'; 4 +import { unref, toRaw, nextTick } from 'vue';
5 import { isArray, isFunction, isObject, isString } from '/@/utils/is'; 5 import { isArray, isFunction, isObject, isString } from '/@/utils/is';
6 import { deepMerge } from '/@/utils'; 6 import { deepMerge } from '/@/utils';
7 import { dateItemType, handleInputNumberValue } from '../helper'; 7 import { dateItemType, handleInputNumberValue } from '../helper';
@@ -39,7 +39,8 @@ export function useFormEvents({ @@ -39,7 +39,8 @@ export function useFormEvents({
39 Object.keys(formModel).forEach((key) => { 39 Object.keys(formModel).forEach((key) => {
40 formModel[key] = defaultValueRef.value[key]; 40 formModel[key] = defaultValueRef.value[key];
41 }); 41 });
42 - clearValidate(); 42 + nextTick(() => clearValidate());
  43 +
43 emit('reset', toRaw(formModel)); 44 emit('reset', toRaw(formModel));
44 submitOnReset && handleSubmit(); 45 submitOnReset && handleSubmit();
45 } 46 }