//定时器操作方法
times(e){
let timestamp = Date.parse(new Date())/1000;//当前时间戳
let date=Number(e)-timestamp;
if(date>0){
let day= Math.floor(date/(60*60*24));
let hours= Math.floor(date/(60*60)%24);
let minutes = Math.floor(date/60%60);
let seconds = Math.floor(date%60);
return day+'天'+hours+'小时'+minutes+'分钟'+seconds+'秒'
}else{
return '倒计时结束'
}
}
网友评论