2021-09-27 08:42:13 +00:00
|
|
|
<template>
|
2021-10-01 12:22:49 +00:00
|
|
|
<span :class="classList" :style="styleList">
|
2021-10-12 03:30:07 +00:00
|
|
|
<slot v-if="type != 'dot'" />
|
2021-10-01 12:22:49 +00:00
|
|
|
</span>
|
2021-09-27 08:42:13 +00:00
|
|
|
</template>
|
|
|
|
|
|
|
|
<script setup name="LayBadge" lang="ts">
|
2021-09-29 09:22:33 +00:00
|
|
|
import { defineProps } from 'vue'
|
2021-09-27 08:42:13 +00:00
|
|
|
|
2021-10-12 03:30:07 +00:00
|
|
|
const props = defineProps<{
|
|
|
|
type?: string
|
|
|
|
theme?: string
|
|
|
|
color?: string
|
|
|
|
}>()
|
2021-09-27 08:42:13 +00:00
|
|
|
|
2021-10-01 12:22:49 +00:00
|
|
|
const classList = [
|
|
|
|
{
|
|
|
|
'layui-badge': !props.type,
|
|
|
|
'layui-badge-dot': props.type == 'dot',
|
|
|
|
'layui-badge-rim': props.type == 'rim',
|
|
|
|
},
|
|
|
|
'layui-bg-' + props.theme,
|
|
|
|
]
|
2021-09-27 08:42:13 +00:00
|
|
|
|
2021-10-01 12:22:49 +00:00
|
|
|
const styleList = props.color ? 'background-color: ' + props.color : ''
|
2021-10-12 03:30:07 +00:00
|
|
|
</script>
|