From ce49de0e3d228e795090ba11a24b34bb940d6fe3 Mon Sep 17 00:00:00 2001
From: wupengfei <834520024@qq.com>
Date: 星期日, 19 十月 2025 21:32:50 +0800
Subject: [PATCH] feat: 1.2.0.1
---
packages/components/src/Calendar/Calendar.vue | 48 ++++++++++++++++++++++++++++++++++++++++++------
1 files changed, 42 insertions(+), 6 deletions(-)
diff --git a/packages/components/src/Calendar/Calendar.vue b/packages/components/src/Calendar/Calendar.vue
index 251bdbb..ec0665b 100644
--- a/packages/components/src/Calendar/Calendar.vue
+++ b/packages/components/src/Calendar/Calendar.vue
@@ -1,16 +1,19 @@
<template>
<div class="bole-calendar-wrapper">
- <div class="bole-calendar-inner">
+ <scroll-view :enhanced="true" :scroll-y="true" :class="['bole-calendar-inner', { isCollapse }]">
<nut-calendar-card v-model="model" class="bole-calendar"></nut-calendar-card>
- </div>
- <div class="bole-calendar-arrow">
- <DownArrow :size="12" />
+ </scroll-view>
+ <div :class="['bole-calendar-arrow', { active: !isCollapse }]" @click="toggle">
+ <DownArrow :size="12" :class="['bole-calendar-arrow-icon']" />
</div>
</div>
</template>
<script setup lang="ts">
import { DownArrow } from '@nutui/icons-vue-taro';
+import Taro from '@tarojs/taro';
+import { useToggle } from 'senin-mini/hooks';
+import { onMounted, ref, watch } from 'vue';
defineOptions({
name: 'Calendar',
@@ -20,6 +23,24 @@
// const props = withDefaults(defineProps<Props>(), {});
const model = defineModel<Date | Date[]>();
+
+const { isCollapse, toggle } = useToggle(true);
+
+onMounted(() => {
+ const query = Taro.createSelectorQuery();
+ query.select('.nut-calendarcard-day.current.active').boundingClientRect();
+ query.select('.bole-calendar-inner').boundingClientRect();
+ query.select('.bole-calendar-inner').node();
+ query.exec(function (res) {
+ const calendarWindowHeight = res[1].height + res[1].top;
+ const currentDayWindowHeight = res[0].height + res[0].top;
+ if (currentDayWindowHeight > calendarWindowHeight) {
+ const scrollView = res[2].node;
+ scrollView?.scrollIntoView?.('.nut-calendarcard-day.current.active');
+ }
+ });
+ console.log('222', 223);
+});
</script>
<style lang="scss">
@@ -31,13 +52,28 @@
}
.bole-calendar-inner {
- height: 500px;
- overflow: hidden;
+ overflow: auto;
+ transition: all 1s ease;
+ max-height: 2000px;
+
+ &.isCollapse {
+ max-height: 500px;
+ }
}
.bole-calendar-arrow {
display: flex;
justify-content: center;
+
+ .bole-calendar-arrow-icon {
+ transition: all 0.2s linear;
+ }
+
+ &.active {
+ .bole-calendar-arrow-icon {
+ transform: rotate(180deg);
+ }
+ }
}
}
</style>
--
Gitblit v1.9.1