From 7c9414a3c75bec8c19bd243fc0d7c102b3279c74 Mon Sep 17 00:00:00 2001 From: Manshu Tusker <35138018+dadaguai-git@users.noreply.github.com> Date: Thu, 8 Aug 2024 19:38:35 +0800 Subject: [PATCH] fix(components): [statistic] fix excessive decimals when value is NAN (#17798) fix(components): [statistic]Fix excessive decimals when value is NAN When the value is NAN, correct the display issue that shows unnecessary decimal points. closed #17784 --- packages/components/statistic/src/statistic.vue | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/packages/components/statistic/src/statistic.vue b/packages/components/statistic/src/statistic.vue index 6749c3d4c7..7bc309a893 100644 --- a/packages/components/statistic/src/statistic.vue +++ b/packages/components/statistic/src/statistic.vue @@ -41,7 +41,8 @@ const displayValue = computed(() => { if (isFunction(formatter)) return formatter(value) - if (!isNumber(value)) return value + // https://github.com/element-plus/element-plus/issues/17784 + if (!isNumber(value) || Number.isNaN(value)) return value let [integer, decimal = ''] = String(value).split('.') decimal = decimal