feat: 流量四舍五入优化
Some checks failed
build / build (push) Has been cancelled

This commit is contained in:
xream
2025-07-22 17:40:50 +08:00
parent 8ab694efcc
commit 3f9867512b
2 changed files with 2 additions and 2 deletions

View File

@@ -230,7 +230,7 @@ export function flowTransfer(flow, unit = 'B') {
let unitIndex = unitList.indexOf(unit);
return flow < 1024 || unitIndex === unitList.length - 1
? { value: flow.toFixed(1), unit: unit }
? { value: (Math.round(flow * 100) / 100).toString(), unit: unit }
: flowTransfer(flow / 1024, unitList[++unitIndex]);
}