From d8d1441ffa87beb84c50ae90d49e519e4381198b Mon Sep 17 00:00:00 2001
From: Tevin <tingquanren@163.com>
Date: Wed, 26 Feb 2025 15:57:37 +0800
Subject: [PATCH] 知识库文档,项目介绍,文案优化

---
 common/Tools.js |   10 +++++-----
 1 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/common/Tools.js b/common/Tools.js
index 4c0ff6d..2f0635d 100644
--- a/common/Tools.js
+++ b/common/Tools.js
@@ -461,7 +461,7 @@
     /**
      * 数值转换为千分位格式
      * @param {Number|String} number - 传入的值
-     * @param {String} decimalFormat - 处理小数的方式  - notRetain(不保留小数,没有小数时才生效),keepTwo(保留两位小数),keepThree(保留三位小数)
+     * @param {String} decimalFormat - 处理小数的方式  - notRetain(不保留小数,有小数时也会去掉小数位),keepTwo(保留两位小数),keepThree(保留三位小数)
      * @return {string}
      */
     static thousandFormat(number, decimalFormat = 'keepTwo') {
@@ -477,9 +477,7 @@
         // 没有小数位
         if (!(num.indexOf('.') > -1)) {
             needThousand = num.toString();
-            if (decimalFormat === 'notRetain') {
-                decimals = '';
-            } else if (decimalFormat === 'keepTwo') {
+            if (decimalFormat === 'keepTwo') {
                 decimals = '00';
             } else if (decimalFormat === 'keepThree') {
                 decimals = '000';
@@ -506,7 +504,9 @@
             let temp = '';
             // 对整数取余
             let remainder = len % 3;
-            decimals ? (temp = '.' + decimals) : temp;
+            if (decimals) {
+                temp = '.' + decimals;
+            }
             if (remainder > 0) {
                 // 不是3的整数倍
                 return (

--
Gitblit v1.9.1