Skip to content

Commit

Permalink
fix: #465
Browse files Browse the repository at this point in the history
  • Loading branch information
kailong321200875 committed Jun 1, 2024
1 parent e0bc713 commit 8996e01
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/components/Form/src/helper/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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
}

0 comments on commit 8996e01

Please sign in to comment.