封装公共函数
作者:互联网
exports.$ = (id) => {
return document.getElementById(id)
}
exports.convertDuration = (time) => { // 计算分钟 02 020 const minutes = "0" + Math.floor(time/60) // 计算秒数 02 020 const seconds = "0" + Math.floor(time - minutes * 60 )
return minutes.substr(-2) + ':' + seconds.substr(-2)
} const { $ } = require('./helper') const musicList = $('musicList')
exports.convertDuration = (time) => { // 计算分钟 02 020 const minutes = "0" + Math.floor(time/60) // 计算秒数 02 020 const seconds = "0" + Math.floor(time - minutes * 60 )
return minutes.substr(-2) + ':' + seconds.substr(-2)
} const { $ } = require('./helper') const musicList = $('musicList')
标签:const,函数,公共,60,substr,time,封装,minutes,id 来源: https://www.cnblogs.com/eric-share/p/15857200.html