Files
heroui-vue/apps/docs/demos/toast-custom-indicator.vue
T

29 lines
747 B
Vue

<script setup lang="ts">
import { onBeforeUnmount } from "vue";
import { h } from "vue";
import { IconStar } from "@tabler/icons-vue";
import {
Button,
ToastProvider,
createToastFunction,
ToastQueue,
type ToastContentValue,
} from "@heroui-vue/components";
const queue = new ToastQueue<ToastContentValue>();
onBeforeUnmount(() => queue.destroy());
const toast = createToastFunction(queue);
function show() {
toast("自定义图标指示器", {
indicator: h(IconStar, { class: "size-5", "aria-hidden": "true" }),
});
}
</script>
<template>
<div class="flex flex-col gap-3">
<Button size="sm" variant="secondary" @click="show">自定义指示器</Button>
<ToastProvider :queue="queue" to="body" />
</div>
</template>