Skip to content

Commit f3093cf

Browse files
committed
feat: 流量四舍五入优化
1 parent 2e19392 commit f3093cf

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "sub-store-front-end",
3-
"version": "2.15.52",
3+
"version": "2.15.53",
44
"private": true,
55
"scripts": {
66
"dev": "vite --host",

src/utils/flowTransfer.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ const flowTransfer = (flow: number, unit: Unit) => {
44
const unitList: Unit[] = ['B', 'KB', 'MB', 'GB', 'TB', 'PB', 'EB', 'ZB', 'YB'];
55
let unitIndex = unitList.indexOf(unit);
66
return (flow < 1024 || unitIndex === unitList.length - 1)
7-
? { value: flow.toFixed(1), unit: unit }
7+
? { value: (Math.round(flow * 100) / 100).toString(), unit: unit }
88
: flowTransfer(flow / 1024, unitList[++unitIndex]);
99
};
1010

0 commit comments

Comments
 (0)