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

This commit is contained in:
sixiTr 2024-09-18 16:45:50 +08:00
parent 7aa001fee9
commit f236109945
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]
}
}