直接上代码
data里面的数据
data(){
return {
pickerOptions: this.getStartStopMonth(),
StartStopMonthArr: ['2023-05', '2023-02'],
startTime: '2023-02',
}
},
methods:{
getStartStopMonth() {
let that = this
return {
disabledDate: (time) => {
let nowYear = new Date().getFullYear();
let nowMonth = new Date().getMonth() + 1;
let nowYM = nowYear + '-' + (nowMonth >= 10 ? nowMonth : ('0' + nowMonth));
let timeM = time.getMonth() + 1;
let timeYM = time.getFullYear() + '-' + (timeM >= 10 ? timeM : ('0' + timeM));
return timeYM > nowYM || that.StartStopMonthArr.includes(timeYM) || timeYM < that.startTime
}
}
}
}
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
- 11
- 12
- 13
- 14
- 15
- 16
- 17
- 18
- 19
- 20
- 21
- 22