fix(useFormEvent): 修复表单项存在defaultValue时,updateSchema方法会将setFieldsValue设置的值覆盖问题 (#3287)
This commit is contained in:
parent
3b2760ca3a
commit
72ef3df57f
|
|
@ -2,7 +2,7 @@ import type { ComputedRef, Ref } from 'vue';
|
||||||
import type { FormProps, FormSchemaInner as FormSchema, FormActionType } from '../types/form';
|
import type { FormProps, FormSchemaInner as 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, nextTick } from 'vue';
|
import { unref, toRaw, nextTick } from 'vue';
|
||||||
import { isArray, isFunction, isObject, isString, isDef, isNil, isEmpty } from '/@/utils/is';
|
import { isArray, isFunction, isObject, isString, isDef, isNil } from '/@/utils/is';
|
||||||
import { deepMerge } from '/@/utils';
|
import { deepMerge } from '/@/utils';
|
||||||
import { dateItemType, handleInputNumberValue, defaultValueComponents } from '../helper';
|
import { dateItemType, handleInputNumberValue, defaultValueComponents } from '../helper';
|
||||||
import { dateUtil } from '/@/utils/dateUtil';
|
import { dateUtil } from '/@/utils/dateUtil';
|
||||||
|
|
@ -310,9 +310,7 @@ export function useFormEvents({
|
||||||
Reflect.has(item, 'field') &&
|
Reflect.has(item, 'field') &&
|
||||||
item.field &&
|
item.field &&
|
||||||
!isNil(item.defaultValue) &&
|
!isNil(item.defaultValue) &&
|
||||||
(!(item.field in currentFieldsValue) ||
|
(!(item.field in currentFieldsValue) || isNil(currentFieldsValue[item.field]))
|
||||||
isNil(currentFieldsValue[item.field]) ||
|
|
||||||
isEmpty(currentFieldsValue[item.field]))
|
|
||||||
) {
|
) {
|
||||||
obj[item.field] = item.defaultValue;
|
obj[item.field] = item.defaultValue;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue