refactor(components): [el-badge] use utils isNumber (#6095)

This commit is contained in:
btea 2022-02-17 10:45:05 +08:00 committed by GitHub
parent 1a1fc7798c
commit 447fbbb638
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -20,6 +20,7 @@
<script lang="ts" setup>
import { computed } from 'vue'
import { useNamespace } from '@element-plus/hooks'
import { isNumber } from '@element-plus/utils'
import { badgeProps } from './badge'
defineOptions({
@ -33,7 +34,7 @@ const ns = useNamespace('badge')
const content = computed<string>(() => {
if (props.isDot) return ''
if (typeof props.value === 'number' && typeof props.max === 'number') {
if (isNumber(props.value) && isNumber(props.max)) {
return props.max < props.value ? `${props.max}+` : `${props.value}`
}
return `${props.value}`