vue horizontal calendar today

Solutions on MaxInterview for vue horizontal calendar today by the best coders in the world

showing results for - "vue horizontal calendar today"
Alberto
31 Jul 2017
1<h4 class="week-title">{{currentFirstDay.year + '年' + currentFirstDay.month + '月'}}</h4>
2<vue-horizontal-calendar
3  style="width:410px;margin: 0 auto;"
4  swipeSpace="7"
5  sundayText="天"
6  :choosedDate="getThisMondayDate"
7  :showBorderTop="false"
8  :resizeable="false"
9  v-on:firstDayChange="firstDayChange"
10></vue-horizontal-calendar>
11
12data() {
13  return {
14    currentFirstDay: {
15      dateFormat: "",
16      year: "",
17      month: "",
18      date: "",
19      day: "",
20      timestamp: ""
21    },
22  }
23}
24methods: {
25  firstDayChange(day) {
26    this.currentFirstDay = day;
27  }
28},
29computed:{
30    // 获取当前日期所在的周‘周一’的日期
31    getThisMondayDate(){
32      let today = new Date();
33      let today_weekCode = today.getDay() == 0? 7: today.getDay();
34      let monday_timestamp = today.getTime() - (today_weekCode - 1) * 1000*3600*24;
35      let monday = new Date(monday_timestamp);
36      return monday.getFullYear() + "/" + (monday.getMonth() + 1) + "/" + monday.getDate();
37    }
38}