fix
This commit is contained in:
@@ -30,9 +30,7 @@
|
||||
/>
|
||||
|
||||
<!-- 统计模块 -->
|
||||
<StatsModule
|
||||
:selected-date="selectedDate"
|
||||
/>
|
||||
<StatsModule :selected-date="selectedDate" />
|
||||
|
||||
<!-- 交易列表模块 -->
|
||||
<TransactionListModule
|
||||
@@ -125,9 +123,10 @@ const onDayClick = async (day) => {
|
||||
const clickedMonth = clickedDate.getMonth()
|
||||
const currentMonth = currentDate.value.getMonth()
|
||||
|
||||
slideDirection.value = clickedMonth > currentMonth || (clickedMonth === 0 && currentMonth === 11)
|
||||
? 'slide-left'
|
||||
: 'slide-right'
|
||||
slideDirection.value =
|
||||
clickedMonth > currentMonth || (clickedMonth === 0 && currentMonth === 11)
|
||||
? 'slide-left'
|
||||
: 'slide-right'
|
||||
|
||||
// 更新 key 触发过渡
|
||||
calendarKey.value += 1
|
||||
@@ -189,8 +188,10 @@ const onDatePickerConfirm = ({ selectedValues }) => {
|
||||
|
||||
// 检查是否超过当前月
|
||||
const today = new Date()
|
||||
if (newDate.getFullYear() > today.getFullYear() ||
|
||||
(newDate.getFullYear() === today.getFullYear() && newDate.getMonth() > today.getMonth())) {
|
||||
if (
|
||||
newDate.getFullYear() > today.getFullYear() ||
|
||||
(newDate.getFullYear() === today.getFullYear() && newDate.getMonth() > today.getMonth())
|
||||
) {
|
||||
showToast('不能选择未来的月份')
|
||||
showDatePicker.value = false
|
||||
return
|
||||
@@ -200,8 +201,8 @@ const onDatePickerConfirm = ({ selectedValues }) => {
|
||||
currentDate.value = newDate
|
||||
|
||||
// 判断是否选择了当前月(复用上面的 today 变量)
|
||||
const isCurrentMonth = newDate.getFullYear() === today.getFullYear() &&
|
||||
newDate.getMonth() === today.getMonth()
|
||||
const isCurrentMonth =
|
||||
newDate.getFullYear() === today.getFullYear() && newDate.getMonth() === today.getMonth()
|
||||
|
||||
// 如果选择的是当前月,选中今天;否则选中该月第一天
|
||||
selectedDate.value = isCurrentMonth ? today : newDate
|
||||
@@ -252,8 +253,8 @@ const changeMonth = async (offset) => {
|
||||
currentDate.value = newDate
|
||||
|
||||
// 判断是否切换到当前月(复用上面的 today 变量)
|
||||
const isCurrentMonth = newDate.getFullYear() === today.getFullYear() &&
|
||||
newDate.getMonth() === today.getMonth()
|
||||
const isCurrentMonth =
|
||||
newDate.getFullYear() === today.getFullYear() && newDate.getMonth() === today.getMonth()
|
||||
|
||||
// 根据切换方向和是否为当前月选择合适的日期
|
||||
let newSelectedDate
|
||||
|
||||
Reference in New Issue
Block a user