武将战力计算(进阶,穿戴,羁绊,好感)加道具

This commit is contained in:
mamengke01
2020-12-14 17:32:40 +08:00
parent a6de265903
commit c501d13f3b
8 changed files with 193 additions and 35 deletions
+25 -1
View File
@@ -410,4 +410,28 @@ export function getItems(str:string) {
});
}
return arr;
}
}
export function deepCopy (obj) {
if (typeof obj !== 'object' || obj === null) {
return obj;
}
var target;
if (obj instanceof Array) {
target = [];
obj.forEach(element => {
target.push(deepCopy(element));
});
} else {
target = {};
for (const key in obj) {
if (obj.hasOwnProperty(key)) {
const element = obj[key];
if (!!element || element == 0) {
target[key] = deepCopy(element);
}
}
}
}
return target;
};