From 7618ea9ffdfa9a2f85d0c159289da9d1254709d4 Mon Sep 17 00:00:00 2001 From: liangping <18786721@qq.com> Date: Mon, 30 Oct 2023 09:21:27 +0800 Subject: [PATCH] re-order formating flow --- src/stores/useFormatter.ts | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/src/stores/useFormatter.ts b/src/stores/useFormatter.ts index f45c61c5..50b3638f 100644 --- a/src/stores/useFormatter.ts +++ b/src/stores/useFormatter.ts @@ -255,14 +255,12 @@ export const useFormatter = defineStore('formatter', { denom = unit.denom.toUpperCase(); } } - - if(amount < 0.01) { - fmt = '0.[000000]' - } if(amount < 0.000001) { return `0 ${denom.substring(0, 10)}`; } - console.log("amount:", amount, numeral(amount).format(fmt)) + if(amount < 0.01) { + fmt = '0.[000000]' + } return `${numeral(amount).format(fmt)} ${ withDenom ? denom.substring(0, 10) : '' }`;