From c2aff84914750c20659e93b9bf6ca92a1308e29f Mon Sep 17 00:00:00 2001 From: JEECG <445654970@qq.com> Date: Tue, 19 Aug 2025 14:04:09 +0800 Subject: [PATCH] =?UTF-8?q?=E3=80=90issues/8683=E3=80=91DatePicker?= =?UTF-8?q?=E7=BB=84=E4=BB=B6=E7=9A=84componentProps=E4=BD=BF=E7=94=A8?= =?UTF-8?q?=E5=87=BD=E6=95=B0=E5=BD=A2=E5=BC=8F=E6=97=B6=E5=88=9D=E5=A7=8B?= =?UTF-8?q?=E5=80=BC=E8=8E=B7=E5=8F=96=E4=B8=8D=E5=AF=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- jeecgboot-vue3/src/components/Form/src/BasicForm.vue | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/jeecgboot-vue3/src/components/Form/src/BasicForm.vue b/jeecgboot-vue3/src/components/Form/src/BasicForm.vue index e7070e662..2991ed9c2 100644 --- a/jeecgboot-vue3/src/components/Form/src/BasicForm.vue +++ b/jeecgboot-vue3/src/components/Form/src/BasicForm.vue @@ -61,6 +61,7 @@ import { useDesign } from '/@/hooks/web/useDesign'; import dayjs from 'dayjs'; import { useDebounceFn } from '@vueuse/core'; + import { isFunction, isObject } from '/@/utils/is'; export default defineComponent({ name: 'BasicForm', @@ -145,9 +146,17 @@ if (defaultValue && dateItemType.includes(component)) { //update-begin---author:wangshuai ---date:20230410 for:【issues/435】代码生成的日期控件赋默认值报错------------ let valueFormat:string = ""; - if(componentProps){ + // update-begin--author:liaozhiyang---date:20250818---for:【issues/8683】DatePicker组件的componentProps使用函数形式时初始值获取不对 + if(isObject(componentProps)) { 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---for【issues/8683】DatePicker组件的componentProps使用函数形式时初始值获取不对 if(!valueFormat){ console.warn("未配置valueFormat,可能导致格式化错误!"); }