Answers for "vue horizontal calendar today"

0

vue horizontal calendar today

<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();
    }
}
Posted by: Guest on September-09-2021

Code answers related to "Javascript"

Browse Popular Code Answers by Language