From f830c733cbc071f023c9a9a4e1571b7c81d672bf Mon Sep 17 00:00:00 2001 From: king <18310653075@163.com> Date: 星期四, 12 十一月 2020 11:47:33 +0800 Subject: [PATCH] 2020-11-12 --- src/tabviews/custom/components/card/cardcellList/index.jsx | 11 ++++++++++- 1 files changed, 10 insertions(+), 1 deletions(-) diff --git a/src/tabviews/custom/components/card/cardcellList/index.jsx b/src/tabviews/custom/components/card/cardcellList/index.jsx index 05728a2..64acb89 100644 --- a/src/tabviews/custom/components/card/cardcellList/index.jsx +++ b/src/tabviews/custom/components/card/cardcellList/index.jsx @@ -145,7 +145,16 @@ } if (card.col && card.col.type === 'number') { - val = val.toFixed(card.col.decimal || 0) + let decimal = card.col.decimal || 0 + + if (card.format === 'percent') { + decimal = decimal - 2 + } + if (decimal < 0) { + decimal = 0 + } + + val = val.toFixed(decimal) } else { val = '' + val } -- Gitblit v1.8.0