Explorar o código

fix: 修复updateSchema之后会把已填值重置为defaultValue的问题 (#1792)

Henry Rao %!s(int64=3) %!d(string=hai) anos
pai
achega
b41e3939ac
Modificáronse 1 ficheiros con 4 adicións e 1 borrados
  1. 4 1
      src/components/Form/src/hooks/useFormValues.ts

+ 4 - 1
src/components/Form/src/hooks/useFormValues.ts

@@ -118,7 +118,10 @@ export function useFormValues({
       const { defaultValue } = item;
       if (!isNullOrUnDef(defaultValue)) {
         obj[item.field] = defaultValue;
-        formModel[item.field] = defaultValue;
+
+        if (formModel[item.field] === undefined) {
+          formModel[item.field] = defaultValue;
+        }
       }
     });
     defaultValueRef.value = obj;