From 8996e01ca35bfad8c13bef321f86bdd711202e12 Mon Sep 17 00:00:00 2001 From: kailong321200875 <321200875@qq.com> Date: Sat, 1 Jun 2024 17:35:17 +0800 Subject: [PATCH] fix: #465 --- src/components/Form/src/helper/index.ts | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/components/Form/src/helper/index.ts b/src/components/Form/src/helper/index.ts index 4b20ead78..dc5258947 100644 --- a/src/components/Form/src/helper/index.ts +++ b/src/components/Form/src/helper/index.ts @@ -159,11 +159,11 @@ export const initModel = (schema: FormSchema[], formModel: Recordable) => { } }) // 如果 schema 对应的 field 不存在,则删除 model 中的对应的 field - Object.keys(model).forEach((key) => { - const isExist = schema.some((item) => item.field === key) - if (!isExist) { + for (let i = 0; i < schema.length; i++) { + const key = schema[i].field + if (!get(model, key)) { delete model[key] } - }) + } return model }