Open webVueBlog opened 4 years ago
timeBtn(e) {
this.query.type = e.currentTarget.dataset.time
const date = new Date()
if(this.query.type==1) {
// 前天
this.query.end_time = ( new Date(date.toLocaleDateString()).getTime() - 60*60*24*1*1000 - 1*1000 ) / 1000
this.query.start_time = ( new Date(date.toLocaleDateString()).getTime() - 60*60*24*2*1000 ) / 1000
}else if(this.query.type==2) {
// 昨天
this.query.end_time = (new Date(date.toLocaleDateString()).getTime() - 1*1000)/1000
this.query.start_time = (new Date(date.toLocaleDateString()).getTime() - 60*60*24*1000)/1000
}else if(this.query.type==3) {
// 今天
this.query.end_time = (Date.parse(date))/1000
this.query.start_time = (new Date(date.toLocaleDateString()).getTime())/1000
}else if(this.query.type==4) {
// 前一小时
this.query.end_time = (Date.parse(date))/1000
this.query.start_time = (Date.parse(date) - 1*60*60*1000)/1000
}
this.$emit('callback', this.query)
this.modalName = null
},
[js]