let date = new Date() for (let m = 1; m < 13; m++) { let num = new Date(date.getFullYear(), m, 0).getDate(); for (let i = 1; i < num + 1; i++) { //再把天数循环出来 let array = []; array[0] = i + '日'; array[1] = m + '月'; array[2] = 0; this.baseData.push(array) } } console.log(this.baseData) //输出每个月的天数