一维数组切换二维数组的方法
new Vue({ el:"#calender", data:{ // 周 daynamearr:["周日","周一","周二","周三","周四","周五","周六"], // 月 dayarr:[ 0,0,0,0,0,1,0, 0,0,0,0,0,1,0, 0,0,0,0,0,1,0, 0,0,0,0,0,1,0, 0,0,0,0,0,1,0, 0,0,0,0,0,1,0 ], }, methods:{ theweek:function(){ let result=[]; for(let i=0;i<this.dayarr.length;i+=7){ result.push(this.dayarr.slice(i,i+7)); } return result; } } })