修复 src 结构
This commit is contained in:
33
src/component/badge/index.less
Normal file
33
src/component/badge/index.less
Normal file
@@ -0,0 +1,33 @@
|
||||
.layui-badge,
|
||||
.layui-badge-dot,
|
||||
.layui-badge-rim {
|
||||
position: relative;
|
||||
display: inline-block;
|
||||
padding: 0 6px;
|
||||
font-size: 12px;
|
||||
text-align: center;
|
||||
background-color: #ff5722;
|
||||
color: #fff;
|
||||
border-radius: 2px;
|
||||
}
|
||||
|
||||
.layui-badge {
|
||||
height: 18px;
|
||||
line-height: 18px;
|
||||
}
|
||||
|
||||
.layui-badge-dot {
|
||||
width: 8px;
|
||||
height: 8px;
|
||||
padding: 0;
|
||||
border-radius: 50%;
|
||||
}
|
||||
|
||||
.layui-badge-rim {
|
||||
height: 18px;
|
||||
line-height: 18px;
|
||||
border-width: 1px;
|
||||
border-style: solid;
|
||||
background-color: #fff;
|
||||
color: #666;
|
||||
}
|
||||
9
src/component/badge/index.ts
Normal file
9
src/component/badge/index.ts
Normal file
@@ -0,0 +1,9 @@
|
||||
import type { App } from "vue";
|
||||
import Component from "./index.vue";
|
||||
import type { IDefineComponent } from "../type/index";
|
||||
|
||||
Component.install = (app: App) => {
|
||||
app.component(Component.name || "LayBadge", Component);
|
||||
};
|
||||
|
||||
export default Component as IDefineComponent;
|
||||
38
src/component/badge/index.vue
Normal file
38
src/component/badge/index.vue
Normal file
@@ -0,0 +1,38 @@
|
||||
<script lang="ts">
|
||||
export default {
|
||||
name: "LayBadge",
|
||||
};
|
||||
</script>
|
||||
|
||||
<script setup lang="ts">
|
||||
import { computed, defineProps } from "vue";
|
||||
import "./index.less";
|
||||
|
||||
export interface LayBadgeProps {
|
||||
type?: "dot" | "rim";
|
||||
theme?: string;
|
||||
color?: string;
|
||||
}
|
||||
const props = defineProps<LayBadgeProps>();
|
||||
|
||||
const classes = computed(() => {
|
||||
return [
|
||||
{
|
||||
"layui-badge": !props.type,
|
||||
"layui-badge-dot": props.type == "dot",
|
||||
"layui-badge-rim": props.type == "rim",
|
||||
},
|
||||
`layui-bg-${props.theme}`,
|
||||
];
|
||||
});
|
||||
|
||||
const styles = computed(() => {
|
||||
props.color ? `background-color: ${props.color}` : "";
|
||||
});
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<span :class="classes" :style="styles">
|
||||
<slot v-if="type != 'dot'"></slot>
|
||||
</span>
|
||||
</template>
|
||||
Reference in New Issue
Block a user