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
This commit is contained in:
Manshu Tusker 2024-08-08 19:38:35 +08:00 committed by GitHub
parent 8692965e80
commit 7c9414a3c7
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -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