【issues/8683】DatePicker组件的componentProps使用函数形式时初始值获取不对

master
JEECG 2025-08-19 14:04:09 +08:00
parent e002cd3bf3
commit c2aff84914
1 changed files with 10 additions and 1 deletions

View File

@ -61,6 +61,7 @@
import { useDesign } from '/@/hooks/web/useDesign'; import { useDesign } from '/@/hooks/web/useDesign';
import dayjs from 'dayjs'; import dayjs from 'dayjs';
import { useDebounceFn } from '@vueuse/core'; import { useDebounceFn } from '@vueuse/core';
import { isFunction, isObject } from '/@/utils/is';
export default defineComponent({ export default defineComponent({
name: 'BasicForm', name: 'BasicForm',
@ -145,9 +146,17 @@
if (defaultValue && dateItemType.includes(component)) { if (defaultValue && dateItemType.includes(component)) {
//update-begin---author:wangshuai ---date:20230410 forissues/435------------ //update-begin---author:wangshuai ---date:20230410 forissues/435------------
let valueFormat:string = ""; let valueFormat:string = "";
if(componentProps){ // update-begin--author:liaozhiyang---date:20250818---forissues/8683DatePickercomponentProps使
if(isObject(componentProps)) {
valueFormat = componentProps?.valueFormat; valueFormat = componentProps?.valueFormat;
} else if (isFunction(componentProps)) {
try {
// @ts-ignore
valueFormat = componentProps({schema, tableAction: props.tableAction, formModel})?.valueFormat;
} catch (error) {
} }
}
// update-end--author:liaozhiyang---date:20250818---forissues/8683DatePickercomponentProps使
if(!valueFormat){ if(!valueFormat){
console.warn("未配置valueFormat,可能导致格式化错误!"); console.warn("未配置valueFormat,可能导致格式化错误!");
} }