标签:class method min return null 倒计时 计时 eth color
export default { data() { return { hours: null, minute: null, second: null } }, methods: { // 秒数 转为 XX时XX分XX秒 time = 传入的秒数 formatTime(time) { this.hours = Math.floor(time / 3600) this.minute = Math.floor(Math.floor(time % 3600) / 60) this.second = time % 60 this.hours = this.hours.toString().length === 1 ? `0${this.hours}` : this.hours this.minute = this.minute.toString().length === 1 ? `0${this.minute}` : this.minute this.second = this.second.toString().length === 1 ? `0${this.second}` : this.second return this.hours + ‘时‘ + this.minute + ‘分‘ + this.second + ‘秒‘ } } }
js-秒数转为XX时XX分XX秒(用于计算剩余时间或倒计时)
标签:class method min return null 倒计时 计时 eth color
原文地址:https://www.cnblogs.com/maxiansheng/p/12331746.html