feat: add Badge and Alert components

This commit is contained in:
maoyingjie
2026-10-21 21:32:40 +08:00
parent 3515a47f5e
commit 4f43789f60
41 changed files with 2422 additions and 17 deletions
+45
View File
@@ -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>