后期修改完善,上线版本
This commit is contained in:
@ -3,7 +3,7 @@
|
||||
<div class="btn" @click="prevYear">
|
||||
<img :src="prevIcon" alt="Previous Year" />
|
||||
</div>
|
||||
<div style="width: 60px;text-align: center; font-family: 'Poppins-Regular', serif">{{ monthName }}</div>
|
||||
<div class="text">{{ monthName }}</div>
|
||||
<div class="btn" @click="nextYear">
|
||||
<img :src="nextIcon" :alt="isNextDisabled ? 'Next Year Disabled' : 'Next Year'" />
|
||||
</div>
|
||||
@ -16,6 +16,20 @@ import IconNext from '@/static/launches/icon_next.png';
|
||||
import IconNextDisabled from '@/static/launches/icon_next_disabled.png';
|
||||
import IconPrevDisabled from '@/static/launches/icon_prev_disabled.png';
|
||||
|
||||
// 从 sessionStorage 获取缓存数据的辅助函数
|
||||
function getCachedMonth() {
|
||||
try {
|
||||
const cachedData = sessionStorage.getItem('launches_search_cache');
|
||||
if (cachedData) {
|
||||
const parsedData = JSON.parse(cachedData);
|
||||
return parsedData.currentMonth || (new Date().getMonth() + 1);
|
||||
}
|
||||
} catch (e) {
|
||||
console.error('获取缓存的月份失败', e);
|
||||
}
|
||||
return new Date().getMonth() + 1;
|
||||
}
|
||||
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
@ -24,7 +38,7 @@ export default {
|
||||
props: {
|
||||
value: {
|
||||
type: Number,
|
||||
default: () => new Date().getMonth() + 1
|
||||
default: getCachedMonth
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
@ -60,15 +74,13 @@ export default {
|
||||
|
||||
<style scoped lang="scss">
|
||||
.box {
|
||||
gap: 16px;
|
||||
color: #3A4A65;
|
||||
font-size: 24px;
|
||||
font-family: 'Poppins-SemiBold', serif;
|
||||
font-family: 'Poppins-SemiBold';
|
||||
.btn {
|
||||
width: 48px;
|
||||
height: 48px;
|
||||
width: 36px;
|
||||
height: 36px;
|
||||
cursor: pointer;
|
||||
background-color: #FFFFFF;
|
||||
border-radius: 4px;
|
||||
|
||||
&:active {
|
||||
@ -80,5 +92,8 @@ export default {
|
||||
height: 100%;
|
||||
}
|
||||
}
|
||||
.text {
|
||||
width: 60px;text-align: center; font-family: 'Poppins-Regular';
|
||||
}
|
||||
}
|
||||
</style>
|
||||
|
||||
Reference in New Issue
Block a user