Przeglądaj źródła

feat: 小数位数设置

zhangweicheng 2 lat temu
rodzic
commit
a695c08cc5
2 zmienionych plików z 2 dodań i 2 usunięć
  1. 1 1
      util/package.json
  2. 1 1
      util/src/math.ts

+ 1 - 1
util/package.json

@@ -1,6 +1,6 @@
 {
   "name": "@sc/util",
-  "version": "1.0.12",
+  "version": "1.0.13",
   "description": "通用的工具包",
   "main": "./dist/index.cjs.js",
   "module": "./dist/index.esm.js",

+ 1 - 1
util/src/math.ts

@@ -24,7 +24,7 @@ export const innerRound = (num: number, length: number, decimal: number): number
 export const roundForObj = (obj: string | number | undefined | null, decimal: number): number => {
   let value;
   if (obj === undefined || obj === null || isNaN(obj as number)) return 0;
-  const length = decimal + 2;
+  const length = 6;
   if (obj === +obj) {
     value = innerRound(obj, length, decimal);
   } else {