From b022a5608b90ed09a8ad0db0ac3dbba0cc8e828c Mon Sep 17 00:00:00 2001
From: jhzh <1628036192@qq.com>
Date: Thu, 03 Oct 2024 21:27:18 +0800
Subject: [PATCH] 1

---
 src/utils/allocation.js |   24 +++++++++++++++++++++++-
 1 files changed, 23 insertions(+), 1 deletions(-)

diff --git a/src/utils/allocation.js b/src/utils/allocation.js
index 27d85a0..0880674 100644
--- a/src/utils/allocation.js
+++ b/src/utils/allocation.js
@@ -1 +1,23 @@
-export const $USD = "USD";
+export const $USD = "₹";
+export const $USDT = "INR";
+
+export function $toLocaleString(
+  number,
+  showCurrencySymbol = true, // 是否显示货币符号,默认为 true
+  locale = "en-IN", // 默认使用印度英语的语言环境
+  options = {
+    // style:可选值为 decimal(小数)、currency(货币)或 percent(百分比);
+    // currency:设置为货币样式时使用的符号,支持列表在这里;
+    // useGrouping:布尔值,是否显示数字分位。
+    style: "currency",
+    currency: "INR",
+    minimumFractionDigits: 2 //如果不想要显示末尾的小数「.00」,只要设置一下最小分位 minimumFractionDigits 即可(默认是 2):
+  }
+) {
+  number = number || 0;
+  let str = Number(number).toLocaleString(locale, options);
+  if (showCurrencySymbol) {
+    str = str.replace("₹", "");
+  }
+  return str;
+}

--
Gitblit v1.9.3