diff --git a/src/utils/index.ts b/src/utils/index.ts index 78022c6ab..d90e67310 100644 --- a/src/utils/index.ts +++ b/src/utils/index.ts @@ -3,6 +3,7 @@ import type { App, Plugin } from 'vue'; import { unref } from 'vue'; import { isObject } from '/@/utils/is'; +import { cloneDeep } from 'lodash-es'; export const noop = () => {}; @@ -35,10 +36,11 @@ export function setObjToUrlParams(baseUrl: string, obj: any): string { // 深度合并 export function deepMerge(src: any = {}, target: any = {}): T { let key: string; + const res: any = cloneDeep(src) for (key in target) { - src[key] = isObject(src[key]) ? deepMerge(src[key], target[key]) : (src[key] = target[key]); + res[key] = isObject(res[key]) ? deepMerge(res[key], target[key]) : (res[key] = target[key]); } - return src; + return res; } export function openWindow(