From 10db00d52c495183578eb490c16401d0b325fc21 Mon Sep 17 00:00:00 2001
From: wupengfei <834520024@qq.com>
Date: 星期一, 20 十月 2025 10:41:22 +0800
Subject: [PATCH] fix: bug
---
packages/components/src/Input/ChooseInputWithDatePicker.vue | 19 ++++++++++++++++---
1 files changed, 16 insertions(+), 3 deletions(-)
diff --git a/packages/components/src/Input/ChooseInputWithDatePicker.vue b/packages/components/src/Input/ChooseInputWithDatePicker.vue
index f14b604..a68a71f 100644
--- a/packages/components/src/Input/ChooseInputWithDatePicker.vue
+++ b/packages/components/src/Input/ChooseInputWithDatePicker.vue
@@ -15,16 +15,23 @@
type Props = {
modelValue: string | number;
+ minDate?: Date;
+ maxDate?: Date;
+ type?: string;
+ format?: string;
};
-const props = withDefaults(defineProps<Props>(), {});
+const props = withDefaults(defineProps<Props>(), {
+ format: 'YYYY-MM-DD',
+});
const emit = defineEmits<{
(e: 'update:modelValue', val: string | number): void;
+ (e: 'change'): void;
}>();
function handleOpen() {
- const _modelValue = [props.modelValue];
+ const _modelValue = dayjs(props.modelValue).toDate();
Portal.add((key) => {
return h(
Portal.Container,
@@ -43,10 +50,16 @@
h(DatePicker, {
modelValue: _modelValue,
onCancel: onClose,
+ type: props.type,
+ maxDate: props.maxDate,
onConfirm: ({ selectedValue }) => {
- emit('update:modelValue', dayjs(selectedValue).format('YYYY-MM-DD'));
+ emit('update:modelValue', dayjs(selectedValue.join('-')).format(props.format));
onClose();
},
+ onChange: () => {
+ emit('change');
+ },
+ minDate: props.minDate,
}),
}
),
--
Gitblit v1.9.1