<el-date-picker
v-model="dialog.month"
type="month"
placeholder="选择月份"
format="yyyy-MM"
value-format="yyyy-MM"
:picker-options="pickerOptionsYearMonth">
</el-date-picker>
12345678原文链接:https://ipkd.cn/webs_1868.html
//禁掉当前月之后的月份
data() {
return {
pickerOptionsYearMonth: {
disabledDate(time) {
return time.getTime() >= Date.now() - 8.64e7;
}
}
}
}
//注释:8.64e7 = 1*24*60*60*1000 = 8.64*10^7
//如果想当月也禁掉
data() {
return {
pickerOptionsYearMonth: {
disabledDate(time) {
let t =new Date().getDate();
return time.getTime() > Date.now() - 8.64e7*t;
}
}
}
}