1
0
mirror of https://github.com/ialley-workshop-open/uni-halo.git synced 2026-06-12 13:19:31 +08:00

feat: 分类页面支持切换不同的展示模式

This commit is contained in:
小莫唐尼
2025-06-16 19:42:45 +08:00
parent eb69ae4af6
commit 2a25727c0b
6 changed files with 467 additions and 233 deletions
+23
View File
@@ -178,7 +178,30 @@ const utils = {
jsonData: {},
}
}
},
isObject(obj) {
return obj && typeof obj === 'object' && !Array.isArray(obj);
},
deepMerge(target, source) {
let output = Object.assign({}, target);
if (this.isObject(target) && this.isObject(source)) {
Object.keys(source).forEach(key => {
const targetValue = target[key];
const sourceValue = source[key];
if (Array.isArray(targetValue) && Array.isArray(sourceValue)) {
output[key] = targetValue.concat(sourceValue);
} else if (this.isObject(targetValue) && this.isObject(sourceValue)) {
output[key] = this.deepMerge(targetValue, sourceValue);
} else {
output[key] = sourceValue;
}
});
}
return output;
}
};