From ad755c7d0e08e698318d73decf361dbcf8da7405 Mon Sep 17 00:00:00 2001 From: Timi Date: Wed, 10 Dec 2025 14:20:21 +0800 Subject: [PATCH] fix calendar layout style --- miniprogram/components/calendar/index.less | 11 +++++------ miniprogram/components/calendar/index.ts | 4 ++-- 2 files changed, 7 insertions(+), 8 deletions(-) diff --git a/miniprogram/components/calendar/index.less b/miniprogram/components/calendar/index.less index 0cbf64b..fcceb87 100644 --- a/miniprogram/components/calendar/index.less +++ b/miniprogram/components/calendar/index.less @@ -3,13 +3,13 @@ flex: 1; height: 100%; display: flex; - padding: 32rpx; overflow: hidden; flex-direction: column; .year { display: flex; - padding: 16rpx 0; + padding: 16rpx 32rpx; + background: var(--theme-bg-secondary); align-items: center; margin-bottom: 24rpx; justify-content: space-between; @@ -18,7 +18,6 @@ width: 64rpx; height: 64rpx; display: flex; - background: var(--theme-bg-card); align-items: center; border-radius: 12rpx; justify-content: center; @@ -37,6 +36,7 @@ .weekdays { display: grid; + padding: 0 32rpx; margin-bottom: 16rpx; grid-template-columns: repeat(7, 1fr); @@ -54,14 +54,13 @@ padding-bottom: 256rpx; .month { - margin-bottom: 48rpx; + padding: 0 32rpx; .title { color: var(--theme-text); - padding: 16rpx 0; font-size: 28rpx; + margin-top: 32rpx; font-weight: 600; - margin-bottom: 16rpx; } .days { diff --git a/miniprogram/components/calendar/index.ts b/miniprogram/components/calendar/index.ts index 16e7c76..70965a9 100644 --- a/miniprogram/components/calendar/index.ts +++ b/miniprogram/components/calendar/index.ts @@ -143,8 +143,8 @@ Component({ }); } - // 下个月需要显示的日期(补齐到 42 个格子,6 行) - const remainingDays = 42 - days.length; + // 下个月需要显示的日期(补齐到 35 个格子,6 行) + const remainingDays = 35 - days.length; for (let day = 1; day <= remainingDays; day++) { const nextMonth = month === 12 ? 1 : month + 1; const nextYear = month === 12 ? year + 1 : year;