根据秒数自动转换天时分
下载moment js
npm install moment --save # npm
import moument from 'moment'
根据秒数大小匹配对应的处理格式
let timer = 3601
var d = moment.duration(timer, 'seconds')
// 小于 1 分钟
if(timer<60) {
console.log(d.seconds() + '秒')
// 小于 1 小时
} else if(timer<3600) {
原创
2022-04-26 10:23:39 ·
403 阅读 ·
0 评论