erp-el-element/utils/ruoyi.js

29 lines
642 B
JavaScript
Raw Permalink Normal View History

2024-05-07 11:51:58 +08:00
// 数据合并
export function mergeRecursive(source, target) {
for (var p in target) {
try {
if (target[p].constructor == Object) {
source[p] = mergeRecursive(source[p], target[p]);
} else {
source[p] = target[p];
}
} catch (e) {
source[p] = target[p];
}
}
// source = target
// for (var p in target) {
// try {
// if (target[p].constructor == Object) {
// source[p] = mergeRecursive(source[p], target[p]);
// } else {
// source[p] = target[p];
// }
// } catch (e) {
// source[p] = target[p];
// }
// }
return source;
};