private pickerOptions: any = {
shortcuts: [
{
text: '最近1小时',
onClick(picker: any) {
const end = new Date();
const start = new Date();
start.setTime(start.getTime() - 1000 * 60 * 60);
picker.$emit('pick', [start, end]);
},
},
{
text: '最近3小时',
onClick(picker: any) {
const end = new Date();
const start = new Date();
start.setTime(start.getTime() - 1000 * 60 * 60 * 3);
picker.$emit('pick', [start, end]);
},
},
{
text: '最近6小时',
onClick(picker: any) {
const end = new Date();
const start = new Date();
start.setTime(start.getTime() - 1000 * 60 * 60 * 6);
picker.$emit('pick', [start, end]);
},
},
{
text: '最近12小时',
onClick(picker: any) {
const end = new Date();
const start = new Date();
start.setTime(start.getTime() - 1000 * 60 * 60 * 12);
picker.$emit('pick', [start, end]);
},
},
{
text: '最近24小时',
onClick(picker: any) {
const end = new Date();
const start = new Date();
start.setTime(start.getTime() - 1000 * 60 * 60 * 24);
picker.$emit('pick', [start, end]);
},
},
{
text: '今天',
onClick(picker: any) {
const end = new Date();
const start = new Date().setHours(0, 0, 0, 0);
picker.$emit('pick', [start, end]);
},
},
{
text: '昨天',
onClick(picker: any) {
const start = new Date().setHours(0, 0, 0, 0) - 1000 * 60 * 60 * 24;
const end = start + 1000 * 60 * 60 * 24 - 1000;
picker.$emit('pick', [start, end]);
},
},
{
text: '前天',
onClick(picker: any) {
const start = new Date().setHours(0, 0, 0, 0) - 1000 * 60 * 60 * 24 * 2;
const end = start + 1000 * 60 * 60 * 24 * 2 - 1000;
picker.$emit('pick', [start, end]);
},
},
],
};
elementui快捷时间
最新推荐文章于 2024-11-13 09:25:38 发布
博客围绕日期时间选择器展开,涉及 elementui 组件,重点关注其中快捷时间的相关内容,在信息技术领域,这对于前端页面时间选择交互设计有一定意义。

1630

被折叠的 条评论
为什么被折叠?



