作者:Federer2012_554 | 来源:互联网 | 2023-10-11 14:25
获取到从那一年开始this.smallYearsres.msg获取当前时间vardatenewDate;this.nowYearsdate.getFullYear()varYear
//获取到从那一年开始
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+ '年'
})
})