feat: migrate Toast and Table with reviewed state focus and SSR contracts
This commit is contained in:
@@ -0,0 +1,49 @@
|
||||
<script setup lang="ts">
|
||||
import { onBeforeUnmount } from "vue";
|
||||
import {
|
||||
Button,
|
||||
ToastContent,
|
||||
ToastTitle,
|
||||
ToastDescription,
|
||||
ToastIndicator,
|
||||
ToastCloseButton,
|
||||
ToastProvider,
|
||||
ToastQueue,
|
||||
createToastFunction,
|
||||
} from "@heroui-vue/components";
|
||||
const queue = new ToastQueue();
|
||||
const toast = createToastFunction(queue);
|
||||
onBeforeUnmount(() => queue.destroy());
|
||||
</script>
|
||||
<template>
|
||||
<div class="flex h-full max-w-xl flex-col items-center justify-center">
|
||||
<Button
|
||||
size="sm"
|
||||
variant="secondary"
|
||||
@click="toast('自定义布局 Toast', { description: '使用自定义渲染函数' })"
|
||||
>
|
||||
自定义 Toast
|
||||
</Button>
|
||||
<ToastProvider
|
||||
:queue="queue"
|
||||
toast-class="rounded-xl border border-border"
|
||||
to="body"
|
||||
>
|
||||
<template #default="{ toast: item, close }">
|
||||
<ToastContent>
|
||||
<div class="flex items-center gap-2">
|
||||
<ToastIndicator class="text-accent" :variant="item.variant" />
|
||||
<div class="flex flex-col pe-6">
|
||||
<ToastTitle class="text-accent">{{ item.title }}</ToastTitle>
|
||||
<ToastDescription>{{ item.description }}</ToastDescription>
|
||||
</div>
|
||||
</div>
|
||||
</ToastContent>
|
||||
<ToastCloseButton
|
||||
class="absolute end-2 top-1/2 -translate-y-1/2 border-none bg-transparent opacity-100 [&>svg]:size-4"
|
||||
@click="close"
|
||||
/>
|
||||
</template>
|
||||
</ToastProvider>
|
||||
</div>
|
||||
</template>
|
||||
Reference in New Issue
Block a user