/
githubmirror
/
element
Обзор
Документация
Войти
/
githubmirror
/
element
Код
Запросы
0
Пакеты
0
Релизы
0
Аналитика
Безопасность
dev
packages/badge/src/main.vue
53 строки
1 KB
Aex
Badge: fix type class when is-dot (#21308)
16 сен 2021, 11:17
Не верифицирован
16 сен 2021, 11:17
492ab00
Код
Авторство
О чём код?
<template> <div class="el-badge"> <slot></slot> <transition name="el-zoom-in-center"> <sup v-show="!hidden && (content || content === 0 || isDot)" v-text="content" class="el-badge__content" :class="[ type ? 'el-badge__content--' + type : null, { 'is-fixed': $slots.default, 'is-dot': isDot } ]"> </sup> </transition> </div> </template> <script> export default { name: 'ElBadge', props: { value: [String, Number], max: Number, isDot: Boolean, hidden: Boolean, type: { type: String, validator(val) { return ['primary', 'success', 'warning', 'info', 'danger'].indexOf(val) > -1; } } }, computed: { content() { if (this.isDot) return; const value = this.value; const max = this.max; if (typeof value === 'number' && typeof max === 'number') { return max < value ? `${max}+` : value; } return value; } } }; </script>