可以跨月份,你先选中开始日期,然后点击第一行向右箭头切换到后面的月份,然后再选中结束日期,这样就跨月了
配置规则:
pickerOptions: {
onPick: ({ maxDate, minDate }) => {
this.choiceDate = minDate.getTime()
if (maxDate) {
this.choiceDate = ''
}
},
disabledDate: (time) => {
const self = this;
if (!!self.choiceDate) {
const startDay = (new Date(self.choiceDate).getDate() - 1) * 24 * 3600 * 1000;
const endDay = (new Date(
new Date(self.choiceDate).getFullYear(),
new Date(self.choiceDate).getMonth() + 1,
0
).getDate() - new Date(self.choiceDate).getDate()) * 24 * 3600 * 1000;
let minTime = self.choiceDate - startDay;
let maxTime = self.choiceDate + endDay;
return time.getTime() < minTime || time.getTime() > maxTime
}
}
},
choiceDate: ''
========================================================
template里面
start-placeholder="开始日期"
end-placeholder="结束日期"
value-format="yyyy-MM-dd"
type="daterange"
align="right">