1 format(interval) { //格式化时间 2 interval = interval | 0//interval为毫秒数 3 const minute = interval / 60 | 0//分钟数为总时间/60 4 const second = this._pad(interval % 60) 5 return `${minute}:${second}` 6 }, 7 _pad(num, n = 2) { //格式化时间,给秒数补0; 8 let len = num.toString().length 9 while (len < n) {10 num = '0' + num11 len++12 }13 return num14 },