mirror of
https://gitee.com/h_mo/uniapp-vue3-vite-ts-template
synced 2025-04-06 03:58:03 +08:00
15 lines
340 B
TypeScript
15 lines
340 B
TypeScript
import { isObject } from '@/utils/is';
|
|
|
|
/**
|
|
* 深度合并
|
|
* @param src
|
|
* @param target
|
|
*/
|
|
export function deepMerge<T = any>(src: any = {}, target: any = {}): T {
|
|
let key: string;
|
|
for (key in target) {
|
|
src[key] = isObject(src[key]) ? deepMerge(src[key], target[key]) : (src[key] = target[key]);
|
|
}
|
|
return src;
|
|
}
|