From c2463c02a17f92df55ec77ed2da3fb724290c072 Mon Sep 17 00:00:00 2001
From: wupengfei <834520024@qq.com>
Date: 星期一, 20 十月 2025 17:34:30 +0800
Subject: [PATCH] fix: bug
---
packages/components/src/Calendar/Calendar.vue | 28 +++++++++++++++++++++-------
1 files changed, 21 insertions(+), 7 deletions(-)
diff --git a/packages/components/src/Calendar/Calendar.vue b/packages/components/src/Calendar/Calendar.vue
index 8a6df76..ec0665b 100644
--- a/packages/components/src/Calendar/Calendar.vue
+++ b/packages/components/src/Calendar/Calendar.vue
@@ -1,11 +1,8 @@
<template>
<div class="bole-calendar-wrapper">
- <div :class="['bole-calendar-inner', { isCollapse }]">
- <nut-calendar-card
- v-model="model"
- class="bole-calendar"
- ></nut-calendar-card>
- </div>
+ <scroll-view :enhanced="true" :scroll-y="true" :class="['bole-calendar-inner', { isCollapse }]">
+ <nut-calendar-card v-model="model" class="bole-calendar"></nut-calendar-card>
+ </scroll-view>
<div :class="['bole-calendar-arrow', { active: !isCollapse }]" @click="toggle">
<DownArrow :size="12" :class="['bole-calendar-arrow-icon']" />
</div>
@@ -14,8 +11,9 @@
<script setup lang="ts">
import { DownArrow } from '@nutui/icons-vue-taro';
+import Taro from '@tarojs/taro';
import { useToggle } from 'senin-mini/hooks';
-import { ref, watch } from 'vue';
+import { onMounted, ref, watch } from 'vue';
defineOptions({
name: 'Calendar',
@@ -27,6 +25,22 @@
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">
--
Gitblit v1.9.1