Browse Source

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

pull/1506/head
lzdjack 5 years ago
committed by GitHub
parent
commit
6b594aec53
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
  1. 5
      src/components/Form/src/hooks/useFormEvents.ts

5
src/components/Form/src/hooks/useFormEvents.ts

@ -1,7 +1,7 @@
import type { ComputedRef, Ref } from 'vue'; import type { ComputedRef, Ref } from 'vue';
import type { FormProps, FormSchema, FormActionType } from '../types/form'; import type { FormProps, FormSchema, FormActionType } from '../types/form';
import type { NamePath } from 'ant-design-vue/lib/form/interface'; import type { NamePath } from 'ant-design-vue/lib/form/interface';
import { unref, toRaw } from 'vue'; import { unref, toRaw, nextTick } from 'vue';
import { isArray, isFunction, isObject, isString } from '/@/utils/is'; import { isArray, isFunction, isObject, isString } from '/@/utils/is';
import { deepMerge } from '/@/utils'; import { deepMerge } from '/@/utils';
import { dateItemType, handleInputNumberValue } from '../helper'; import { dateItemType, handleInputNumberValue } from '../helper';
@ -39,7 +39,8 @@ export function useFormEvents({
Object.keys(formModel).forEach((key) => { Object.keys(formModel).forEach((key) => {
formModel[key] = defaultValueRef.value[key]; formModel[key] = defaultValueRef.value[key];
}); });
clearValidate(); nextTick(() => clearValidate());
emit('reset', toRaw(formModel)); emit('reset', toRaw(formModel));
submitOnReset && handleSubmit(); submitOnReset && handleSubmit();
} }

Loading…
Cancel
Save