pickerOptions: {
disabledDate (time) {
let secondNum = 60 * 60 * 24 * 7 * 1000; //上下波动7天
if (timeOptionRange) {
return (
time.getTime() > timeOptionRange.getTime() + secondNum ||
time.getTime() < timeOptionRange.getTime() - secondNum
);
}
},
onPick (time) {
//当第一时间选中才设置禁用
if (time.minDate && !time.maxDate) {
timeOptionRange = time.minDate;
}
if (time.maxDate) {
timeOptionRange = null;
}
}
},
<el-col :span="7">
<label>统计时间:</label>
<el-date-picker v-model="params.createdTime"
type="datetimerange"
size="small"
range-separator="至"
start-placeholder="开始时间"
end-placeholder="结束时间"
:picker-options="pickerOptions"
@change="changeDate"></el-date-picker>
</el-col>
网友评论