|
@ -1,24 +1,14 @@ |
|
|
<script setup lang="ts"> |
|
|
<script setup lang="ts"> |
|
|
const props = defineProps<{ |
|
|
const { title, message, duration } = defineProps<{ |
|
|
title: string; |
|
|
title: string; |
|
|
message: string; |
|
|
message: string; |
|
|
duration?: number; |
|
|
duration?: number; |
|
|
}>(); |
|
|
}>(); |
|
|
|
|
|
|
|
|
const open = ref(true); |
|
|
|
|
|
|
|
|
|
|
|
const autoCloseToast = props.duration ? Number(props.duration) : 12000; // 12 seconds |
|
|
|
|
|
|
|
|
|
|
|
onMounted(() => { |
|
|
|
|
|
setTimeout(() => { |
|
|
|
|
|
open.value = false; |
|
|
|
|
|
}, autoCloseToast); |
|
|
|
|
|
}); |
|
|
|
|
|
</script> |
|
|
</script> |
|
|
|
|
|
|
|
|
<template> |
|
|
<template> |
|
|
<ToastRoot |
|
|
<ToastRoot |
|
|
v-model:open="open" |
|
|
:duration="duration" |
|
|
class="bg-red-800 rounded-md p-2 text-neutral-200" |
|
|
class="bg-red-800 rounded-md p-2 text-neutral-200" |
|
|
> |
|
|
> |
|
|
<ToastTitle class="mb-4 font-medium text-lg">{{ title }} </ToastTitle> |
|
|
<ToastTitle class="mb-4 font-medium text-lg">{{ title }} </ToastTitle> |
|
|