html部分:
<el-date-picker
size="mini"
style="width: 90%"
v-model="searchInfo.dates"
type="datetimerange"
:picker-options="mergePickerOptions"
range-separator="至"
start-placeholder="开始日期"
end-placeholder="结束日期"
:default-time="['00:00:00', '23:59:59']"
clearable
></el-date-picker>
data 部分 :
data(){
return {
searchInfo:{
dates: [
new Date(new Date().setHours(0, 0, 0, 0) - 3600 * 1000 * 24 * 2),//默认开始时间
new Date(
new Date().getFullYear(),
new Date().getMonth(),
new Date().getDate(),
new Date().getHours(),
new Date().getMinutes()
), // 默认结束时间
],
}
}
}
效果如下: