| | |
| | | }); |
| | | } |
| | | }; |
| | | const weeksNeeded = computed(() => { |
| | | const firstDay = dayjs(currentMonth.value).startOf('month').day(); |
| | | const days = dayjs(currentMonth.value).daysInMonth(); |
| | | return Math.ceil((firstDay + days) / 7); |
| | | }); |
| | | |
| | | const weeksNeeded = computed(() => { |
| | | const date = dayjs(currentMonth.value); |
| | | const firstDay = date.startOf('month').day(); // 0-6 (周日到周六) |
| | | const days = date.daysInMonth(); |
| | | |
| | | // 强制 2025 年 6 月显示六行 |
| | | if (date.year() === 2025 && date.month() === 5) { |
| | | return 6; |
| | | } |
| | | |
| | | // 其他月份按原逻辑计算 |
| | | return Math.ceil((firstDay + days) / 7); |
| | | }) |
| | | const isSixRows = computed(() => weeksNeeded.value > 5); |
| | | onMounted(() => { |
| | | // 初始化时如果是当前月份,选中当天;否则不选中 |