feat: migrate AlertDialog and Drawer with reviewed overlay lifecycles
This commit is contained in:
@@ -0,0 +1,61 @@
|
||||
<script setup lang="ts">
|
||||
import {
|
||||
Button,
|
||||
Drawer,
|
||||
DrawerBackdrop,
|
||||
DrawerBody,
|
||||
DrawerClose,
|
||||
DrawerCloseTrigger,
|
||||
DrawerContent,
|
||||
DrawerDialog,
|
||||
DrawerFooter,
|
||||
DrawerHandle,
|
||||
DrawerHeader,
|
||||
DrawerHeading,
|
||||
} from "@heroui-vue/components";
|
||||
|
||||
const PLACEMENT_LABELS = {
|
||||
bottom: "底部",
|
||||
left: "左侧",
|
||||
right: "右侧",
|
||||
top: "顶部",
|
||||
} as const;
|
||||
const placements = ["bottom", "top", "left", "right"] as const;
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<div class="flex flex-wrap gap-4">
|
||||
<Drawer v-for="placement in placements" :key="placement">
|
||||
<Button variant="secondary">{{ PLACEMENT_LABELS[placement] }}</Button>
|
||||
<DrawerBackdrop>
|
||||
<DrawerContent :placement="placement">
|
||||
<DrawerDialog>
|
||||
<DrawerCloseTrigger />
|
||||
<DrawerHandle v-if="placement === 'bottom'" />
|
||||
<DrawerHeader>
|
||||
<DrawerHeading>
|
||||
{{ PLACEMENT_LABELS[placement] }}抽屉
|
||||
</DrawerHeading>
|
||||
</DrawerHeader>
|
||||
<DrawerBody>
|
||||
<p>
|
||||
此抽屉从屏幕
|
||||
<strong>{{ PLACEMENT_LABELS[placement] }}</strong>
|
||||
边缘滑入。
|
||||
</p>
|
||||
</DrawerBody>
|
||||
<DrawerFooter>
|
||||
<DrawerClose as-child>
|
||||
<Button variant="secondary">取消</Button>
|
||||
</DrawerClose>
|
||||
<DrawerClose as-child>
|
||||
<Button>完成</Button>
|
||||
</DrawerClose>
|
||||
</DrawerFooter>
|
||||
<DrawerHandle v-if="placement === 'top'" />
|
||||
</DrawerDialog>
|
||||
</DrawerContent>
|
||||
</DrawerBackdrop>
|
||||
</Drawer>
|
||||
</div>
|
||||
</template>
|
||||
Reference in New Issue
Block a user