Kchengz / epic-designer

vue3 表单设计器
MIT License
285 stars 52 forks source link

fix: 修复deepCompareAndModify修改后的对象与源对象类型不一致的问题 #20

Closed alex-80 closed 3 months ago

alex-80 commented 4 months ago

复现示例:

const a = { key1: [] };
const b = { key1: { key2: 1 } };
deepCompareAndModify(a, b)
console.log(JSON.stringify(a) === JSON.stringify(b))

const c = { key1: {} };
const d = { key1: [{ key2: 1 }] };
deepCompareAndModify(c, d)
console.log(JSON.stringify(c) === JSON.stringify(d))

期望结果: 结果都为true 实际结果: 结果都为false

Kchengz commented 3 months ago

非常感谢您发现了这个问题并给我提供了解决方案