mirror of
https://github.com/vbenjs/vue-vben-admin.git
synced 2025-01-25 02:58:43 +08:00
fix(deepMerge): 去掉合并错误的代码 (#2848)
This commit is contained in:
parent
9c43c74131
commit
1f287145f4
@ -52,14 +52,6 @@ export function deepMerge<T extends object | null | undefined, U extends object
|
|||||||
target: U,
|
target: U,
|
||||||
mergeArrays: 'union' | 'intersection' | 'concat' | 'replace' = 'replace',
|
mergeArrays: 'union' | 'intersection' | 'concat' | 'replace' = 'replace',
|
||||||
): T & U {
|
): T & U {
|
||||||
|
|
||||||
return mergeWith(cloneDeep(target), source, (objValue, srcValue) => {
|
|
||||||
if (isObject(objValue) && isObject(srcValue)) {
|
|
||||||
return mergeWith(cloneDeep(objValue), srcValue, (prevValue, nextValue) => {
|
|
||||||
// 如果是数组,合并数组(去重) If it is an array, merge the array (remove duplicates)
|
|
||||||
return isArray(prevValue) ? unionWith(prevValue, nextValue, isEqual) : undefined;
|
|
||||||
});
|
|
||||||
|
|
||||||
if (!target) {
|
if (!target) {
|
||||||
return source as T & U;
|
return source as T & U;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user