Skip to content

Commit

Permalink
fix: 🐛 提高"initModel判断schema对应的field是否存在,兼容null与0等场景"代码健壮性
Browse files Browse the repository at this point in the history
  • Loading branch information
ShanYi-Hui committed Dec 13, 2024
1 parent 7f7ab6e commit 35920af
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/components/Form/src/helper/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,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 (!model.hasOwnProperty(key)) {
if (!Object.prototype.hasOwnProperty.call(model, key)) {
delete model[key]
}
}
Expand Down

0 comments on commit 35920af

Please sign in to comment.