From 21dd6a5eed00f9abd3d1f36623f4752b2b4edf70 Mon Sep 17 00:00:00 2001 From: icssoa <615206459@qq.com> Date: Wed, 10 Sep 2025 10:58:31 +0800 Subject: [PATCH] =?UTF-8?q?cl-calendar=20=E6=94=AF=E6=8C=81=E6=B7=BB?= =?UTF-8?q?=E5=8A=A0=E4=B8=8A=E4=B8=8B=E6=96=87=E6=A1=88?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pages/demo/form/calendar.uvue | 181 ++++++++- .../cl-calendar-select.uvue | 34 +- .../components/cl-calendar/cl-calendar.uvue | 346 +++++++++++------- .../components/cl-calendar/picker.uvue | 2 +- uni_modules/cool-ui/types/index.ts | 8 + 5 files changed, 410 insertions(+), 161 deletions(-) diff --git a/pages/demo/form/calendar.uvue b/pages/demo/form/calendar.uvue index 79f043f..3ddee9d 100644 --- a/pages/demo/form/calendar.uvue +++ b/pages/demo/form/calendar.uvue @@ -5,37 +5,188 @@ - - + + + + + + - + + + - + + + + + + + + + + + + + + + + diff --git a/uni_modules/cool-ui/components/cl-calendar-select/cl-calendar-select.uvue b/uni_modules/cool-ui/components/cl-calendar-select/cl-calendar-select.uvue index 66abfc8..1056965 100644 --- a/uni_modules/cool-ui/components/cl-calendar-select/cl-calendar-select.uvue +++ b/uni_modules/cool-ui/components/cl-calendar-select/cl-calendar-select.uvue @@ -33,7 +33,8 @@ v-model="value" v-model:date="date" :mode="mode" - :disabled-date="disabledDate" + :date-config="dateConfig" + @change="onCalendarChange" > @@ -68,7 +69,7 @@ @@ -694,7 +775,6 @@ onMounted(() => { &__view { @apply w-full; - /* Web端DOM渲染样式 */ // #ifndef APP /* 日期行样式 */ &-row { @@ -706,16 +786,6 @@ onMounted(() => { @apply flex-1 flex flex-col items-center justify-center relative; height: 80rpx; - /* 选中状态样式 */ - &.is-selected { - background-color: v-bind("props.selectedBgColor"); - } - - /* 范围选择背景样式 */ - &.is-range { - background-color: v-bind("props.rangeBgColor"); - } - /* 隐藏状态(相邻月份日期) */ &.is-hide { opacity: 0; diff --git a/uni_modules/cool-ui/components/cl-calendar/picker.uvue b/uni_modules/cool-ui/components/cl-calendar/picker.uvue index 109b6cf..64606b6 100644 --- a/uni_modules/cool-ui/components/cl-calendar/picker.uvue +++ b/uni_modules/cool-ui/components/cl-calendar/picker.uvue @@ -140,7 +140,7 @@ const list = computed(() => { // - 年份模式下显示“起始年 - 结束年” const title = computed(() => { return mode.value == "month" - ? `${year.value}年` + ? `${year.value}` : `${first(list.value)?.label} - ${last(list.value)?.label}`; }); diff --git a/uni_modules/cool-ui/types/index.ts b/uni_modules/cool-ui/types/index.ts index 59f84e1..5446d12 100644 --- a/uni_modules/cool-ui/types/index.ts +++ b/uni_modules/cool-ui/types/index.ts @@ -200,3 +200,11 @@ export type ClTreeNodeInfo = { }; export type ClCalendarMode = "single" | "multiple" | "range"; + +export type ClCalendarDateConfig = { + date: string; + topText?: string; + bottomText?: string; + disabled?: boolean; + color?: string; +};