|
@@ -107,7 +107,7 @@
|
|
|
<text class="calendar-month">{{ currentMonthLabel }}</text>
|
|
<text class="calendar-month">{{ currentMonthLabel }}</text>
|
|
|
</view>
|
|
</view>
|
|
|
<view class="calendar-grid">
|
|
<view class="calendar-grid">
|
|
|
- <view class="calendar-day" v-for="(day, index) in monthDays" :key="index" :class="getDayClass(day)">
|
|
|
|
|
|
|
+ <view class="calendar-day" v-for="(day, index) in monthDays" :key="index" :class="day.dayClass">
|
|
|
<text class="day-number">{{ day.day }}</text>
|
|
<text class="day-number">{{ day.day }}</text>
|
|
|
<view class="day-fortune" v-if="day.fortune">
|
|
<view class="day-fortune" v-if="day.fortune">
|
|
|
<view class="fortune-bubble" :class="'fortune-' + day.fortune.fortuneLevel"></view>
|
|
<view class="fortune-bubble" :class="'fortune-' + day.fortune.fortuneLevel"></view>
|
|
@@ -227,7 +227,9 @@ export default {
|
|
|
|
|
|
|
|
// 填充上月尾部
|
|
// 填充上月尾部
|
|
|
for (let i = 0; i < firstDay; i++) {
|
|
for (let i = 0; i < firstDay; i++) {
|
|
|
- days.push({ day: '', date: null })
|
|
|
|
|
|
|
+ const emptyDay = { day: '', date: null }
|
|
|
|
|
+ emptyDay.dayClass = this.getDayClass(emptyDay).join(' ')
|
|
|
|
|
+ days.push(emptyDay)
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
// 填充当月
|
|
// 填充当月
|
|
@@ -246,6 +248,8 @@ export default {
|
|
|
if (fortune) {
|
|
if (fortune) {
|
|
|
dayData.fortune = fortune
|
|
dayData.fortune = fortune
|
|
|
}
|
|
}
|
|
|
|
|
+ // 预计算 class 字符串(小程序 :class 不支持方法调用)
|
|
|
|
|
+ dayData.dayClass = this.getDayClass(dayData).join(' ')
|
|
|
days.push(dayData)
|
|
days.push(dayData)
|
|
|
}
|
|
}
|
|
|
|
|
|