From 67b678f67b873d8fdfa6fda07704f6a3a804fc69 Mon Sep 17 00:00:00 2001 From: xream Date: Mon, 25 Mar 2024 03:51:05 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E6=B5=81=E9=87=8F=E5=8D=95=E4=BD=8D?= =?UTF-8?q?=E6=98=BE=E7=A4=BA=E7=94=B1=20EB=20=E6=8F=90=E5=8D=87=E5=88=B0?= =?UTF-8?q?=20YB?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- package.json | 2 +- src/utils/flowTransfer.ts | 7 +++---- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/package.json b/package.json index c0a94b585..0ffc5339d 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "sub-store-front-end", - "version": "2.14.212", + "version": "2.14.213", "private": true, "scripts": { "dev": "vite --host", diff --git a/src/utils/flowTransfer.ts b/src/utils/flowTransfer.ts index 4bd7cbcf7..6638011a4 100644 --- a/src/utils/flowTransfer.ts +++ b/src/utils/flowTransfer.ts @@ -1,10 +1,9 @@ -type Unit = 'B' | 'KB' | 'MB' | 'GB' | 'TB' | 'PB' | 'EB'; +type Unit = 'B' | 'KB' | 'MB' | 'GB' | 'TB' | 'PB' | 'EB' | 'ZB' | 'YB'; const flowTransfer = (flow: number, unit: Unit) => { - const unitList: Unit[] = ['B', 'KB', 'MB', 'GB', 'TB', 'PB', 'EB']; + const unitList: Unit[] = ['B', 'KB', 'MB', 'GB', 'TB', 'PB', 'EB', 'ZB', 'YB']; let unitIndex = unitList.indexOf(unit); - - return flow < 1024 + return (flow < 1024 || unitIndex === unitList.length - 1) ? { value: flow.toFixed(1), unit: unit } : flowTransfer(flow / 1024, unitList[++unitIndex]); };