Browse Source

fix: initModel判断schema对应的field是否存在,兼容null与0等场景

sixiTr 7 months ago
parent
commit
f236109945
1 changed files with 1 additions and 1 deletions
  1. 1 1
      src/components/Form/src/helper/index.ts

+ 1 - 1
src/components/Form/src/helper/index.ts

@@ -161,7 +161,7 @@ export const initModel = (schema: FormSchema[], formModel: Recordable) => {
   // 如果 schema 对应的 field 不存在,则删除 model 中的对应的 field
   for (let i = 0; i < schema.length; i++) {
     const key = schema[i].field
-    if (!get(model, key) && get(model, key) !== 0) {
+    if (!model.hasOwnProperty(key)) {
       delete model[key]
     }
   }