Fixed #1207 - Slot support for Badge component

pull/1196/head^2
Cagatay Civici 2021-05-12 15:25:12 +03:00
parent af4f9183a3
commit 81c0928fa0
1 changed files with 4 additions and 2 deletions

View File

@ -1,5 +1,7 @@
<template> <template>
<span :class="badgeClass">{{value}}</span> <span :class="badgeClass">
<slot>{{value}}</slot>
</span>
</template> </template>
<script> <script>
@ -17,7 +19,7 @@ export default {
badgeClass() { badgeClass() {
return ['p-badge p-component', { return ['p-badge p-component', {
'p-badge-no-gutter': this.value && String(this.value).length === 1, 'p-badge-no-gutter': this.value && String(this.value).length === 1,
'p-badge-dot': !this.value, 'p-badge-dot': !this.value && !this.$slots.default,
'p-badge-lg': this.size === 'large', 'p-badge-lg': this.size === 'large',
'p-badge-xl': this.size === 'xlarge', 'p-badge-xl': this.size === 'xlarge',
'p-badge-info': this.severity === 'info', 'p-badge-info': this.severity === 'info',