// 倒计时事件
countdown () {
const that = this
that.countTime = moment(moment().format('YYYY-MM-DD 24:00:00')).diff(moment().format('YYYY-MM-DD HH:mm:ss'), 'seconds')
that.countTime = 10
that._interval = setInterval(() => {
if (that.countTime === 0) {
that.isSign = false
// 计时结束,清除缓存
clearInterval(that._interval)
} else {
that.countTime--
let hr = parseInt(that.countTime / 60 / 60 % 24)
let min = parseInt(that.countTime / 60 % 60)
let sec = parseInt(that.countTime % 60)
hr = hr > 9 ? hr : '0' + hr
min = min > 9 ? min : '0' + min
sec = sec > 9 ? sec : '0' + sec
that.signMsg = `签到倒计时 ${hr}:${min}:${sec}`
}
}, 1000)
},
利用moment 计算出秒数的差别,然后在计算出时分秒