bug修复

This commit is contained in:
FengHui
2026-04-13 12:29:47 +08:00
parent 3d8e13c665
commit 321e686d68
5 changed files with 109 additions and 25 deletions

View File

@@ -46,12 +46,10 @@
<script setup>
import { reactive, inject, watch, ref, onMounted } from 'vue';
import { onLoad, onShow } from '@dcloudio/uni-app';
const { $api, navTo, navBack } = inject('globalFunction');
const { $api, navTo, navBack, LunarUtil } = inject('globalFunction');
const weekMap = ['日', '一', '二', '三', '四', '五', '六'];
const calendarData = ref([]);
const current = ref({});
import lunarModule from '@/packageA/lib/lunar-javascript@1.7.2.js';
const { Solar, Lunar } = lunarModule;
const isRecord = ref(false);
const recordNum = ref(4);
@@ -162,12 +160,11 @@ function getMonthCalendarData({ year, month, selectableDates = [] }) {
const d = prevLastDate - i;
const prevMonth = month - 1 <= 0 ? 12 : month - 1;
const prevYear = month - 1 <= 0 ? year - 1 : year;
const solar = Solar.fromYmd(prevYear, prevMonth, d);
const lunar = Lunar.fromSolar(solar);
const nl = LunarUtil.getLunarDayInChinese(prevYear, prevMonth, d);
const dateStr = `${prevYear}-${String(prevMonth).padStart(2, '0')}-${String(d).padStart(2, '0')}`;
list.push({
day: d,
nl: lunar.getDayInChinese(),
nl: nl,
isThisMonth: false,
isToday: dateStr === todayStr,
isSelectable: isSelected(prevYear, prevMonth, d),
@@ -179,12 +176,11 @@ function getMonthCalendarData({ year, month, selectableDates = [] }) {
// 当前月天数
for (let d = 1; d <= lastDate; d++) {
const solar = Solar.fromYmd(year, month, d);
const lunar = Lunar.fromSolar(solar);
const nl = LunarUtil.getLunarDayInChinese(year, month, d);
const dateStr = `${year}-${String(month).padStart(2, '0')}-${String(d).padStart(2, '0')}`;
list.push({
day: d,
nl: lunar.getDayInChinese(),
nl: nl,
isThisMonth: true,
isToday: dateStr === todayStr,
isSelectable: isSelected(year, month, d),
@@ -199,12 +195,11 @@ function getMonthCalendarData({ year, month, selectableDates = [] }) {
for (let d = 1; d <= remaining; d++) {
const nextMonth = month + 1 > 12 ? 1 : month + 1;
const nextYear = month + 1 > 12 ? year + 1 : year;
const solar = Solar.fromYmd(nextYear, nextMonth, d);
const lunar = Lunar.fromSolar(solar);
const nl = LunarUtil.getLunarDayInChinese(nextYear, nextMonth, d);
const dateStr = `${nextYear}-${String(nextMonth).padStart(2, '0')}-${String(d).padStart(2, '0')}`;
list.push({
day: d,
nl: lunar.getDayInChinese(),
nl: nl,
isThisMonth: false,
isToday: dateStr === todayStr,
isSelectable: isSelected(nextYear, nextMonth, d),