用日期获取周几

<view class="weeks">
	<text @click="switchWeek(index)" v-for="(item,index) in ['周天',' 周一','周二','周三','周四','周五','周六']" class="item zk_pressed1"
	:class="{active:curWeekIndex==index}">{{item}}</text>
</view>

  

data() {
            return {
              
                curWeekIndex: 0,
              
            }
        },
methods:

            switchWeek(index: any) {
                
                this.curWeekIndex = index;
                
            },
                    
//在获取打卡列表的里写

  getRecord(date:any){
var that:any = this var weekDay = ["星期天", "星期一", "星期二", "星期三", "星期四", "星期五", "星期六"]; var b = new Date(Date.parse(date.replace(/-/g,"/"))); // console.log(b.getDay()); console看一下 this.curWeekIndex = b.getDay(); },

原文地址:https://www.cnblogs.com/lsongyang/p/13518299.html