feat: add Badge and Alert components
This commit is contained in:
@@ -0,0 +1,45 @@
|
||||
<script setup lang="ts">
|
||||
import {
|
||||
Avatar,
|
||||
AvatarImage,
|
||||
AvatarFallback,
|
||||
Badge,
|
||||
BadgeAnchor,
|
||||
} from "@heroui-vue/components";
|
||||
|
||||
const AVATAR_URL =
|
||||
"https://heroui-assets.nyc3.cdn.digitaloceanspaces.com/avatars/green.jpg";
|
||||
|
||||
const placements = [
|
||||
"top-right",
|
||||
"top-left",
|
||||
"bottom-right",
|
||||
"bottom-left",
|
||||
] as const;
|
||||
|
||||
const PLACEMENT_LABELS: Record<(typeof placements)[number], string> = {
|
||||
"bottom-left": "左下",
|
||||
"bottom-right": "右下",
|
||||
"top-left": "左上",
|
||||
"top-right": "右上",
|
||||
};
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<div class="flex items-center gap-8">
|
||||
<div
|
||||
v-for="placement in placements"
|
||||
:key="placement"
|
||||
class="flex flex-col items-center gap-2"
|
||||
>
|
||||
<BadgeAnchor>
|
||||
<Avatar>
|
||||
<AvatarImage alt="头像" :src="AVATAR_URL" />
|
||||
<AvatarFallback>JD</AvatarFallback>
|
||||
</Avatar>
|
||||
<Badge color="accent" :placement="placement" size="sm" />
|
||||
</BadgeAnchor>
|
||||
<span class="text-xs text-muted">{{ PLACEMENT_LABELS[placement] }}</span>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
Reference in New Issue
Block a user