mirror of
https://github.com/element-plus/element-plus.git
synced 2025-02-05 11:21:11 +08:00
refactor(components): [el-badge] use utils isNumber (#6095)
This commit is contained in:
parent
1a1fc7798c
commit
447fbbb638
@ -20,6 +20,7 @@
|
|||||||
<script lang="ts" setup>
|
<script lang="ts" setup>
|
||||||
import { computed } from 'vue'
|
import { computed } from 'vue'
|
||||||
import { useNamespace } from '@element-plus/hooks'
|
import { useNamespace } from '@element-plus/hooks'
|
||||||
|
import { isNumber } from '@element-plus/utils'
|
||||||
import { badgeProps } from './badge'
|
import { badgeProps } from './badge'
|
||||||
|
|
||||||
defineOptions({
|
defineOptions({
|
||||||
@ -33,7 +34,7 @@ const ns = useNamespace('badge')
|
|||||||
const content = computed<string>(() => {
|
const content = computed<string>(() => {
|
||||||
if (props.isDot) return ''
|
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.max < props.value ? `${props.max}+` : `${props.value}`
|
||||||
}
|
}
|
||||||
return `${props.value}`
|
return `${props.value}`
|
||||||
|
Loading…
Reference in New Issue
Block a user