DateTimePicker 日期选择器 选择时间范围在一个月内
<el-date-picker type="daterange" unlink-panels value-format="yyyy-MM-dd" range-separator="至" start-placeholder="开始日期" end-placeholder="结束日期" :picker-options="pickerOptions"> </el-date-picker>
data() {
return {
selectDate: '',
//日期选择范围在一个月内
pickerOptions: {
onPick: ({maxDate, minDate}) => {
this.selectDate= minDate.getTime();
if (maxDate) {
this.selectDate= ''
}
}, disabledDate: (time) => {
if (this.selectDate!== '') {
const one = 30 * 24 * 3600 * 1000;
const minTime = this.selectDate- one;
const maxTime = this.selectDate+ one;
return time.getTime() < minTime || time.getTime() > maxTime
}
}
}
}
},