时间戳
// 时间戳
// return hh:mm:ss
getDigitalClock: function (timeStamp, withSecond = true) {
let date = new Date(timeStamp);
let hh = date.getHours() < 10 ? "0" + date.getHours() : date.getHours();
let mm =
date.getMinutes() < 10 ? "0" + date.getMinutes() : date.getMinutes();
let ss =
date.getSeconds() < 10 ? "0" + date.getSeconds() : date.getSeconds();
return withSecond ? `${hh}:${mm}:${ss}` : `${hh}:${mm}`;
},
倒计时
time:function(){
let totalSeconds =this.axamList.result.remainTime;
setInterval(() => {
totalSeconds -= 1000;
this.remainTime= this.getDigitalClock(totalSeconds);
}, 1000)
}