数字督察一体化平台-前端
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 

52 lines
1.2 KiB

<template>
<el-date-picker
type="datetimerange"
start-placeholder="开始时间"
end-placeholder="结束时间"
value-format="YYYY-MM-DD HH:mm:ss"
:shortcuts="shortcuts"
:unlink-panels="true"
/>
</template>
<script setup>
const shortcuts = [
{
text: "今天",
value: () => {
const end = new Date();
const start = new Date();
start.setHours(0, 0, 0, 0);
return [start, end];
},
},
{
text: "近一周",
value: () => {
const end = new Date();
const start = new Date();
start.setDate(start.getDate() - 7);
return [start, end];
},
},
{
text: "近一个月",
value: () => {
const end = new Date();
const start = new Date();
start.setMonth(start.getMonth() - 1)
return [start, end];
},
},
{
text: "近三个月",
value: () => {
const end = new Date();
const start = new Date();
start.setMonth(start.getMonth() - 3)
return [start, end];
},
},
];
</script>
<style lang="scss" scoped>
</style>