【类 型】:feat
【原 因】: 【过 程】:新增一个 秒数格式化函数 格式化成 00:00 格式 【影 响】: # 类型 包含: # feat:新功能(feature) # fix:修补bug # docs:文档(documentation) # style: 格式(不影响代码运行的变动) # refactor:重构(即不是新增功能,也不是修改bug的代码变动) # test:增加测试 # chore:构建过程或辅助工具的变动
This commit is contained in:
parent
f4c5104fa9
commit
02e1daa419
@ -75,6 +75,23 @@ export function formatTime(value) {
|
||||
|
||||
return `(${period})${hour}:${minute}`
|
||||
}
|
||||
|
||||
/**
|
||||
* 格式化秒数为 mm:ss 的格式
|
||||
* @param {number} seconds 总秒数
|
||||
* @returns {string} 格式化后的时间字符串
|
||||
*/
|
||||
export function formatSeconds(seconds) {
|
||||
if (seconds < 0) return '00:00' // 如果秒数为负,则返回 00:00
|
||||
|
||||
let minutes = Math.floor(seconds / 60)
|
||||
let remainingSeconds = seconds % 60
|
||||
|
||||
minutes = minutes.toString().padStart(2, '0')
|
||||
remainingSeconds = remainingSeconds.toString().padStart(2, '0')
|
||||
|
||||
return `${minutes}:${remainingSeconds}`
|
||||
}
|
||||
/**
|
||||
* 过滤价格数值 超过小数点两位得 保留两位
|
||||
* @param {string} value
|
||||
@ -257,7 +274,7 @@ function initMqtt() {
|
||||
const topic = `refreshOrderList/${store.state.userInfo.topic_prefix}`
|
||||
mqtt.doSubscribe(topic, (res) => {
|
||||
if (res.topic.indexOf(topic) > -1) {
|
||||
store.dispatch('fetchOrderList').then(()=>{
|
||||
store.dispatch('fetchOrderList').then(() => {
|
||||
console.log('有订单更新')
|
||||
}) //更新订单
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user