<template>
<el-date-picker
v-model="queryParams.purchaseTime"
type="monthrange" format="yyyy-MM" value-format="yyyy-MM"
:picker-options="pickerOptionsQuarter"
:style="{width: '100%'}" start-placeholder="开始时间" end-placeholder="结束时间"
range-separator="至" clearable
></el-date-picker>
</template>
不可选本月及之后的日期:
data() {
return {
pickerOptionsMonth: {
disabledDate(time) {
let year = new Date().getFullYear();
let month = new Date().getMonth();
let days = new Date(year, month, 0).getDate();
const timeDifference = days * 86400776 // 时间差
return time.getTime() > Date.now() - timeDifference;
}
},
}
}
不可选本月之后的日期
data() {
return {
pickerOptionsMonth: {
disabledDate(time) {
return time.getTime() > Date.now() - 8.64e6;
}
},
}
}