要实现的功能 :日期选择器要有多个可选范围 比如 2022-07-01——2022-08-31和2022-12-01——2023-01-31
html
<el-date-picker v-model="searchForm.curveDate" align="right" type="date"
placeholder="选择日期" :picker-options="pickerOptions" value-format="yyyy-MM-dd" />
vue data
pickerOptions: this.dateRange()
methods
dateRange() {
let that = this;
return {
disabledDate(time) {
return (
(time.getTime() > new Date(that.summerEndTime).getTime() ||
time.getTime() <
new Date(that.summerStartTime).getTime() - 3600 * 1000 * 24) &&
(time.getTime() > new Date(that.winterEndTime).getTime() ||
time.getTime() <
new Date(that.winterStartTime).getTime() - 3600 * 1000 * 24)
);
},
};
},