From 1476d27514874e9c95002451a81878bd9bec8382 Mon Sep 17 00:00:00 2001 From: wujingjing <gersonwu@qq.com> Date: 星期六, 14 十二月 2024 15:36:53 +0800 Subject: [PATCH] 多轮对话 --- src/utils/util.ts | 15 +++++++++++++++ 1 files changed, 15 insertions(+), 0 deletions(-) diff --git a/src/utils/util.ts b/src/utils/util.ts index 4b07f4e..d92279e 100644 --- a/src/utils/util.ts +++ b/src/utils/util.ts @@ -630,6 +630,21 @@ return percent; }; + + +/** + * 淇濈暀鎸囧畾绮惧害灏忔暟浣嶏紝涓斾笉琛ラ浂 + * @param num + * @param precision + * @returns + */ +export const toMyFixed = (num, precision) => { + if (num == null) return ''; + if (!precision) return num + ''; + const factor = Math.pow(10, precision); + return Math.round(Number(num) * factor) / factor + ''; +}; + /** * * @param {*} func 闃叉姈鍑芥暟 -- Gitblit v1.9.3