【issues/7940】componentProps写成函数形式时,updateSchema写成对象时,参数没合并 ---

dev
JEECG 3 months ago
parent cba4847413
commit 61d2857ca7

@ -3,7 +3,7 @@ import type { App, Plugin } from 'vue';
import type { FormSchema } from "@/components/Form"; import type { FormSchema } from "@/components/Form";
import { unref } from 'vue'; import { unref } from 'vue';
import { isObject } from '/@/utils/is'; import { isObject, isFunction } from '/@/utils/is';
import Big from 'big.js'; import Big from 'big.js';
// update-begin--author:sunjianlei---date:20220408---for: VUEN-656# // update-begin--author:sunjianlei---date:20220408---for: VUEN-656#
export const URL_HASH_TAB = `__AGWE4H__HASH__TAG__PWHRG__`; export const URL_HASH_TAB = `__AGWE4H__HASH__TAG__PWHRG__`;
@ -41,7 +41,28 @@ export function deepMerge<T = any>(src: any = {}, target: any = {}): T {
let key: string; let key: string;
for (key in target) { for (key in target) {
// update-begin--author:liaozhiyang---date:20240329---forQQYUN-7872onlinelabel // update-begin--author:liaozhiyang---date:20240329---forQQYUN-7872onlinelabel
src[key] = isObject(src[key]) && isObject(target[key]) ? deepMerge(src[key], target[key]) : (src[key] = target[key]); if (isObject(src[key]) && isObject(target[key])) {
src[key] = deepMerge(src[key], target[key]);
} else {
// update-begin--author:liaozhiyang---date:20250318---forissues/7940componentPropsupdateSchema
try {
if (isFunction(src[key]) && isObject(src[key]()) && isObject(target[key])) {
// src[key]target[key]
src[key] = deepMerge(src[key](), target[key]);
} else if (isObject(src[key]) && isFunction(target[key]) && isObject(target[key]())) {
// target[key]src[key]
src[key] = deepMerge(src[key], target[key]());
} else if (isFunction(src[key]) && isFunction(target[key]) && isObject(src[key]()) && isObject(target[key]())) {
// src[key]target[key]
src[key] = deepMerge(src[key](), target[key]());
} else {
src[key] = target[key];
}
} catch (error) {
src[key] = target[key];
}
// update-end--author:liaozhiyang---date:20250318---forissues/7940componentPropsupdateSchema
}
// update-end--author:liaozhiyang---date:20240329---forQQYUN-7872onlinelabel // update-end--author:liaozhiyang---date:20240329---forQQYUN-7872onlinelabel
} }
return src; return src;

Loading…
Cancel
Save