typescript
<el-date-picker v-model="ruleForm.years" type="year" :disabled-date="pickerOptions"
placeholder="请选择获奖年度" class="wih-650p" value-format="YYYY" />
- 之前
typescript
const disabledDateFun = (time: any) => {
if (time.getTime() < new Date().getTime()) {
return time.getTime() <= new Date().getTime() - 1 * 8.64e7; //时间范围必须是时间戳
}
};
- 之后
typescript
const pickerOptions = (time: any) => {
return new Date().getFullYear() < time.getFullYear();
};
效果图: