2021-11-17 15:37:54 +00:00
|
|
|
<script lang="ts">
|
|
|
|
export default {
|
|
|
|
name: "LayBadge",
|
|
|
|
};
|
|
|
|
</script>
|
2021-09-27 08:42:13 +00:00
|
|
|
|
2021-11-17 15:37:54 +00:00
|
|
|
<script setup lang="ts">
|
|
|
|
import { computed, defineProps } from "vue";
|
|
|
|
import "./index.less";
|
2021-09-27 08:42:13 +00:00
|
|
|
|
2021-11-17 15:37:54 +00:00
|
|
|
export interface LayBadgeProps {
|
|
|
|
type?: "dot" | "rim";
|
|
|
|
theme?: string;
|
|
|
|
color?: string;
|
|
|
|
}
|
|
|
|
const props = defineProps<LayBadgeProps>();
|
2021-09-27 08:42:13 +00:00
|
|
|
|
2021-11-17 15:37:54 +00:00
|
|
|
const classes = computed(() => {
|
|
|
|
return [
|
|
|
|
{
|
|
|
|
"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-11-17 15:37:54 +00:00
|
|
|
const styles = computed(() => {
|
|
|
|
props.color ? `background-color: ${props.color}` : "";
|
|
|
|
});
|
2021-10-12 03:30:07 +00:00
|
|
|
</script>
|
2021-11-17 15:37:54 +00:00
|
|
|
|
|
|
|
<template>
|
|
|
|
<span :class="classes" :style="styles">
|
2021-12-24 16:09:30 +00:00
|
|
|
<slot v-if="type != 'dot'"></slot>
|
2021-11-17 15:37:54 +00:00
|
|
|
</span>
|
2021-12-24 05:42:56 +00:00
|
|
|
</template>
|