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

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