Merge pull request #537 from sixiTr/fixs-initModel

fix: initModel判断schema对应的field是否存在,兼容null与0等场景
This commit is contained in:
Archer 2024-09-23 09:41:59 +08:00 committed by GitHub
commit ed301a5b9d
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 1 additions and 1 deletions

View File

@ -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]
}
}