feat: add icon support for badge component

This commit is contained in:
Methapon Metanipat 2024-10-28 10:23:35 +07:00
parent 8ea21b1795
commit de20b984e8

View file

@ -1,5 +1,7 @@
<script setup lang="ts">
import { Icon } from '@iconify/vue';
defineProps<{
icon?: string;
title?: string;
titleI18n?: string;
hslaColor?: string;
@ -11,7 +13,8 @@ defineProps<{
class="rounded q-px-sm flex-center"
:style="`color: hsla(var(${!!hslaColor ? hslaColor : '--green-6-hsl'}) / 0.8); background: hsla(var(${!!hslaColor ? hslaColor : '--green-6-hsl'}) / 0.1); `"
>
&#128900;
<template v-if="!icon">&#128900;</template>
<Icon v-else :icon style="margin-right: 0.25rem" />
{{ title || (!!titleI18n ? $t(titleI18n) : '-') }}
</div>
</template>