<h4 class="week-title">{{currentFirstDay.year + '年' + currentFirstDay.month + '月'}}</h4>
<vue-horizontal-calendar
style="width:410px;margin: 0 auto;"
swipeSpace="7"
sundayText="天"
:choosedDate="getThisMondayDate"
:showBorderTop="false"
:resizeable="false"
v-on:firstDayChange="firstDayChange"
></vue-horizontal-calendar>
data() {
return {
currentFirstDay: {
dateFormat: "",
year: "",
month: "",
date: "",
day: "",
timestamp: ""
},
}
}
methods: {
firstDayChange(day) {
this.currentFirstDay = day;
}
},
computed:{
getThisMondayDate(){
let today = new Date();
let today_weekCode = today.getDay() == 0? 7: today.getDay();
let monday_timestamp = today.getTime() - (today_weekCode - 1) * 1000*3600*24;
let monday = new Date(monday_timestamp);
return monday.getFullYear() + "/" + (monday.getMonth() + 1) + "/" + monday.getDate();
}
}