Files
heroui-vue/apps/docs/demos/alert-dialog-sizes.vue
T

70 lines
2.1 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 { IconRocket } from "@tabler/icons-vue";
import {
AlertDialog,
AlertDialogBackdrop,
AlertDialogBody,
AlertDialogClose,
AlertDialogCloseTrigger,
AlertDialogContainer,
AlertDialogDialog,
AlertDialogFooter,
AlertDialogHeader,
AlertDialogHeading,
AlertDialogIcon,
Button,
} from "@heroui-vue/components";
const SIZE_LABELS = {
cover: "通栏",
lg: "大",
md: "中",
sm: "小",
xs: "超小",
} as const;
const sizes = ["xs", "sm", "md", "lg", "cover"] as const;
</script>
<template>
<div class="flex flex-wrap gap-4">
<AlertDialog v-for="size in sizes" :key="size">
<Button variant="secondary">{{ SIZE_LABELS[size] }}</Button>
<AlertDialogBackdrop>
<AlertDialogContainer :size="size">
<AlertDialogDialog>
<AlertDialogCloseTrigger />
<AlertDialogHeader>
<AlertDialogIcon class="bg-default text-foreground">
<IconRocket aria-hidden="true" class="size-5" />
</AlertDialogIcon>
<AlertDialogHeading>
尺寸:{{ SIZE_LABELS[size] }}
</AlertDialogHeading>
</AlertDialogHeader>
<AlertDialogBody>
<p v-if="size === 'cover'">
此警告框使用
<code>cover</code>
尺寸:在移动端与桌面端保留边距铺满可视区域,仍保持圆角与标准内边距。
</p>
<p v-else>
此警告框使用
<code>{{ size }}</code>
尺寸。在移动端各尺寸都会接近全宽以便阅读;在桌面端则对应不同的最大宽度。
</p>
</AlertDialogBody>
<AlertDialogFooter>
<AlertDialogClose as-child>
<Button variant="tertiary">取消</Button>
</AlertDialogClose>
<AlertDialogClose as-child>
<Button>确认</Button>
</AlertDialogClose>
</AlertDialogFooter>
</AlertDialogDialog>
</AlertDialogContainer>
</AlertDialogBackdrop>
</AlertDialog>
</div>
</template>