<el-date-picker v-model="time" type="datetimerange" range-separator="至" start-placeholder="开始日期" end-placeholder="结束日期" :clearable="clearable" :picker-options="pickerOptions" @change="changeTime" ></el-date-picker>
data(){ return{ pickerOptions: { onPick(time) { if (!time.maxDate) { let timeRange = 1 * 24 * 60 * 60 * 1000 //限制范围 _minTime = time.minDate.getTime() - timeRange _maxTime = time.minDate.getTime() + timeRange } else { _minTime = _maxTime = null } }, disabledDate(time) { if (_minTime && _maxTime) { return time.getTime() < _minTime || time.getTime() > _maxTime } else { return time.getTime() < Date.now() - 1 * 24 * 60 * 60 * 1000 } } } } }