From e01cee0f0c5c5c2eb2d8595eadb3c7a9df2a37fc Mon Sep 17 00:00:00 2001
From: 李凌 <344137771@qq.com>
Date: Wed, 21 Jan 2026 16:37:01 +0800
Subject: [PATCH] 1
---
src/utils/index.js | 9 +++++----
1 files changed, 5 insertions(+), 4 deletions(-)
diff --git a/src/utils/index.js b/src/utils/index.js
index 214438f..b4f1894 100644
--- a/src/utils/index.js
+++ b/src/utils/index.js
@@ -78,7 +78,6 @@
}
}
-
// 小数展示,保留五位小数
export const formatNumber = (num) => {
if (typeof (num) !== 'number') {
@@ -99,7 +98,6 @@
}
}
-
// 保留五位小数
export const formatNumberToFixedFive = (num) => {
@@ -137,7 +135,6 @@
}
}
-
export const formatMoney = (val) => {
if(val === 0){
return 0
@@ -161,10 +158,14 @@
return (val / Math.pow(num, 4)).toFixed(2) + "T"; //T
}
-
export const formatNews = (str) => {
if(!str) {
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