From 6bd333a41c769dff1e47f12a42fa32dc7b07f7f2 Mon Sep 17 00:00:00 2001 From: liangping <18786721@qq.com> Date: Wed, 16 Feb 2022 13:57:03 +0800 Subject: [PATCH] improve display of accounts --- src/libs/utils.js | 5 +++-- src/views/WalletAccounts.vue | 19 +++++++++---------- src/views/components/WalletInput.vue | 6 +++--- 3 files changed, 15 insertions(+), 15 deletions(-) diff --git a/src/libs/utils.js b/src/libs/utils.js index e36bc012..09befd4f 100644 --- a/src/libs/utils.js +++ b/src/libs/utils.js @@ -363,7 +363,7 @@ export function numberWithCommas(x) { return parts.join('.') } -export function formatTokenAmount(tokenAmount, fraction = 2, tokenDenom = 'uatom') { +export function formatTokenAmount(tokenAmount, fraction = 2, tokenDenom = 'uatom', format = true) { const denom = tokenDenom.denom_trace ? tokenDenom.denom_trace.base_denom : tokenDenom let amount = 0 @@ -378,7 +378,8 @@ export function formatTokenAmount(tokenAmount, fraction = 2, tokenDenom = 'uatom }) amount = Number(Number(tokenAmount)) / (10 ** exp) if (amount > 10) { - return numberWithCommas(parseFloat(amount.toFixed(fraction))) + if (format) { return numberWithCommas(parseFloat(amount.toFixed(fraction))) } + return parseFloat(amount.toFixed(fraction)) } return parseFloat(amount.toFixed(fraction)) } diff --git a/src/views/WalletAccounts.vue b/src/views/WalletAccounts.vue index 92ead107..2bbf5033 100644 --- a/src/views/WalletAccounts.vue +++ b/src/views/WalletAccounts.vue @@ -1,7 +1,6 @@