Files
heroui-vue/apps/docs/demos/alert-basic.vue
T
2026-10-21 21:32:40 +08:00

93 lines
2.7 KiB
Vue
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
<script setup lang="ts">
import {
Alert,
AlertContent,
AlertDescription,
AlertIndicator,
AlertTitle,
Button,
CloseButton,
Spinner,
} from "@heroui-vue/components";
</script>
<template>
<div class="grid w-full max-w-xl gap-4">
<!-- 默认 — 一般信息 -->
<Alert>
<AlertIndicator />
<AlertContent>
<AlertTitle>新功能已上线</AlertTitle>
<AlertDescription>
查看我们的最新更新,包括深色模式支持与改进的无障碍体验。
</AlertDescription>
</AlertContent>
</Alert>
<!-- 强调 — 重要信息含操作 -->
<Alert status="accent">
<AlertIndicator />
<AlertContent>
<AlertTitle>有可用更新</AlertTitle>
<AlertDescription>
应用有新版本可用。请刷新页面以获取最新功能与问题修复。
</AlertDescription>
<Button class="mt-2 sm:hidden" size="sm" variant="primary">刷新</Button>
</AlertContent>
<Button class="hidden sm:block" size="sm" variant="primary">刷新</Button>
</Alert>
<!-- 危险 — 错误与排查步骤 -->
<Alert status="danger">
<AlertIndicator />
<AlertContent>
<AlertTitle>无法连接到服务器</AlertTitle>
<AlertDescription>
当前遇到连接问题,请尝试以下操作:
<ul class="mt-2 list-inside list-disc space-y-1 text-sm">
<li>检查网络连接</li>
<li>刷新页面</li>
<li>清除浏览器缓存</li>
</ul>
</AlertDescription>
<Button class="mt-2 sm:hidden" size="sm" variant="danger">重试</Button>
</AlertContent>
<Button class="hidden sm:block" size="sm" variant="danger">重试</Button>
</Alert>
<!-- 无描述 -->
<Alert status="success">
<AlertIndicator />
<AlertContent>
<AlertTitle>个人资料已更新</AlertTitle>
</AlertContent>
<CloseButton />
</Alert>
<!-- 自定义指示器 — 加载中 -->
<Alert status="accent">
<AlertIndicator>
<Spinner size="sm" />
</AlertIndicator>
<AlertContent>
<AlertTitle>正在处理你的请求</AlertTitle>
<AlertDescription>
正在同步你的数据,请稍候,这可能需要一点时间。
</AlertDescription>
</AlertContent>
</Alert>
<!-- 无关闭按钮 -->
<Alert status="warning">
<AlertIndicator />
<AlertContent>
<AlertTitle>计划维护</AlertTitle>
<AlertDescription>
我们将于 UTC 时间 3 月 15 日(周日)凌晨 2:00 至上午 6:00
进行计划维护,期间服务将暂时不可用。
</AlertDescription>
</AlertContent>
</Alert>
</div>
</template>