From a4c96bc72ac16efdbb6a55814e13e4eeb46f1835 Mon Sep 17 00:00:00 2001
From: 李凌 <344137771@qq.com>
Date: Thu, 18 Sep 2025 19:40:12 +0800
Subject: [PATCH] 2
---
src/utils/index.js | 5 +++++
1 files changed, 5 insertions(+), 0 deletions(-)
diff --git a/src/utils/index.js b/src/utils/index.js
index 214438f..49b2e1a 100644
--- a/src/utils/index.js
+++ b/src/utils/index.js
@@ -167,4 +167,9 @@
return ''
}
return str.replace(/<img [^>]*src=['"]([^'"]+)[^>]*>/g, '').replace(/ /ig, '')
+}
+
+export const formatWithCommas = (num) => {
+ if (num === null || num === undefined || isNaN(num)) return '--';
+ return num.toString().replace(/\B(?=(\d{3})+(?!\d))/g, ',');
}
\ No newline at end of file
--
Gitblit v1.9.3