let type = 5 //近n个月的
let month = new Date().getMonth() + 1 //当前月份
let year = new Date().getFullYear() //今年
for(let i=1;i<=type;i++){
let date = ''
if(month >= i){
date = year + '-' + (month - i + 1)
} else {
date = (year-1) + '-' + (12 + month - i + 1)
}
console.log(date)
}