获取近一年的日期
let getMonth =function(){
var dataArr =[];
var data =newDate();
var year = data.getFullYear();
data.setMonth(data.getMonth()+1,1);//获取到当前月份,设置月份for(var i =0; i <12; i++){
data.setMonth(data.getMonth()-1);//每次循环一次 月份值减1
var m = data.getMonth()+1;
m = m <10?"0"+ m : m;
console.log(m)
dataArr.push(data.getFullYear()+"-"+ m);//添加年份}return dataArr;};
console.log(getMonth())