'admin-22.06.07:函数deepClone对null的判断错误'

This commit is contained in:
lyt 2022-06-07 22:30:57 +08:00
parent 3a57a7f4ff
commit 4259e9931f

View File

@ -113,7 +113,7 @@ export function deepClone(obj: any) {
newObj = {}; newObj = {};
} }
for (let attr in obj) { for (let attr in obj) {
if (typeof obj[attr] === 'object') { if (obj[attr] && typeof obj[attr] === 'object') {
newObj[attr] = deepClone(obj[attr]); newObj[attr] = deepClone(obj[attr]);
} else { } else {
newObj[attr] = obj[attr]; newObj[attr] = obj[attr];