onLoad: function (options) { var that = this; var oDate = new Date(); var dayArr = []; for (var i = 0; i < 7; i++) {/*后7天*/ dayArr.push(new Date(oDate.getFullYear(), oDate.getMonth(), oDate.getDate() + i)); } var date=[]; for (var j = 0; j < dayArr.length;j++){ date[j]={}; date[j].day = that.filterMonth(dayArr[j].getDate()); date[j].month = that.filterMonth(dayArr[j].getMonth()+1); date[j].week = that.week(j, dayArr[j].getDay()); date[j].simweek = that.simweek(dayArr[j].getDay()); } console.log(date) that.setData({ date: date}) }, simweek: function (week){ var weekDaay = ['日', '一', '二', '三', '四', '五', '六']; switch (week) { case 0: return weekDaay[week]; break; case 1: return weekDaay[week]; break; case 2: return weekDaay[week]; break; case 3: return weekDaay[week]; break; case 4: return weekDaay[week]; break; case 5: return weekDaay[week]; break; case 6: return weekDaay[week]; break; } }, week:function(j,week){ var weekDaay = ['星期日', '星期一', '星期二', '星期三', '星期四', '星期五', '星期六']; switch (j) { case 0: return '今天'; break; case 1: return '明天'; break; case 2: return '后天'; break; case 3: return weekDaay[week]; break; case 4: return weekDaay[week]; break; case 5: return weekDaay[week]; break; case 6: return weekDaay[week]; break; } }, filterMonth:function(m){ if(m<10){ return '0'+m }else{ return m; } },