feat: migrate AlertDialog and Drawer with reviewed overlay lifecycles

This commit is contained in:
maoyingjie
2026-10-23 18:34:07 +08:00
parent 9f44ffb310
commit 0ec20aaa6a
83 changed files with 5871 additions and 3 deletions
@@ -0,0 +1,54 @@
<script setup lang="ts">
import {
Button,
Drawer,
DrawerBackdrop,
DrawerBody,
DrawerClose,
DrawerCloseTrigger,
DrawerContent,
DrawerDialog,
DrawerFooter,
DrawerHandle,
DrawerHeader,
DrawerHeading,
} 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">
<Drawer v-for="variant in variants" :key="variant">
<Button variant="secondary">{{ VARIANT_LABELS[variant] }}</Button>
<DrawerBackdrop :variant="variant">
<DrawerContent>
<DrawerDialog>
<DrawerHandle />
<DrawerCloseTrigger />
<DrawerHeader>
<DrawerHeading>背景:{{ VARIANT_LABELS[variant] }}</DrawerHeading>
</DrawerHeader>
<DrawerBody>
<p>
此抽屉使用
<code>{{ variant }}</code>
背景变体。
</p>
</DrawerBody>
<DrawerFooter>
<DrawerClose as-child>
<Button class="w-full">关闭</Button>
</DrawerClose>
</DrawerFooter>
</DrawerDialog>
</DrawerContent>
</DrawerBackdrop>
</Drawer>
</div>
</template>