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

64 lines
2.0 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 {
AlertDialog,
AlertDialogBackdrop,
AlertDialogBody,
AlertDialogClose,
AlertDialogCloseTrigger,
AlertDialogContainer,
AlertDialogDialog,
AlertDialogFooter,
AlertDialogHeader,
AlertDialogHeading,
AlertDialogIcon,
Button,
} from "@heroui-vue/components";
const VARIANT_LABELS = {
blur: "模糊",
opaque: "不透明",
transparent: "透明",
} as const;
const variants = ["opaque", "blur", "transparent"] as const;
</script>
<template>
<div class="flex flex-wrap gap-4">
<AlertDialog v-for="variant in variants" :key="variant">
<Button variant="secondary">{{ VARIANT_LABELS[variant] }}</Button>
<AlertDialogBackdrop :variant="variant">
<AlertDialogContainer>
<AlertDialogDialog class="sm:max-w-[400px]">
<AlertDialogCloseTrigger />
<AlertDialogHeader>
<AlertDialogIcon status="accent" />
<AlertDialogHeading>
背景:{{ VARIANT_LABELS[variant] }}
</AlertDialogHeading>
</AlertDialogHeader>
<AlertDialogBody>
<p>
{{
variant === "opaque"
? "不透明的深色背景会完全遮挡背后内容,让用户把注意力集中在对话框上。"
: variant === "blur"
? "模糊背景会柔和地虚化背后内容,同时保留一定的环境上下文。"
: "透明背景会完整保留背后内容,适合重要性较低的确认场景。"
}}
</p>
</AlertDialogBody>
<AlertDialogFooter>
<AlertDialogClose as-child>
<Button variant="tertiary">取消</Button>
</AlertDialogClose>
<AlertDialogClose as-child>
<Button>确认</Button>
</AlertDialogClose>
</AlertDialogFooter>
</AlertDialogDialog>
</AlertDialogContainer>
</AlertDialogBackdrop>
</AlertDialog>
</div>
</template>