let wekks=this.getweekday('2021-03-28'); console.log(wekks);//输出‘日’ function getweekday(date){ var weekArray = new Array("日", "一", "二", "三", "四", "五", "六"); var week = weekArray[new Date(date).getDay()];//注意此处必须是先new一个Date return week; }
let wekks=this.getweekday('2021-03-28'); console.log(wekks);//输出‘日’ function getweekday(date){ var weekArray = new Array("日", "一", "二", "三", "四", "五", "六"); var week = weekArray[new Date(date).getDay()];//注意此处必须是先new一个Date return week; }