layui/src/module/badge/index.vue

27 lines
552 B
Vue
Raw Normal View History

2021-09-27 08:42:13 +00:00
<template>
2021-10-01 12:22:49 +00:00
<span :class="classList" :style="styleList">
<slot v-if="type != 'dot'"></slot>
</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
const props =
defineProps<{
2021-10-01 12:22:49 +00:00
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-09-27 08:42:13 +00:00
</script>