//获取到从那一年开始
this.smallYears = res.msg
//获取当前时间
var date = new Date;
this.nowYears = date.getFullYear()
var Years = this.nowYears - this.smallYears
var arrYear = [];
for (var i = 0; i <= Years; i++) {
arrYear.push(this.nowYears--)
}
arrYear.forEach(v=> {
//下拉框的数组
this.yearsData.push({
value: v,
label: v+ '年'
})
})
js遍历出从某一年到最新年份
最新推荐文章于 2023-08-04 14:50:41 发布