You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
27 lines
607 B
27 lines
607 B
<template>
|
|
<div class="toast toast-bottom toast-end z-50">
|
|
<div
|
|
v-for="t in toasts"
|
|
:key="t.id"
|
|
:class="['alert', alertClass(t.type)]"
|
|
>
|
|
<span>{{ t.msg }}</span>
|
|
</div>
|
|
</div>
|
|
</template>
|
|
|
|
<script setup lang="ts">
|
|
import type { ToastType } from '~/composables/useToast'
|
|
|
|
const { toasts } = useToast()
|
|
|
|
function alertClass(type: ToastType): string {
|
|
switch (type) {
|
|
case 'success': return 'alert-success'
|
|
case 'error': return 'alert-error'
|
|
case 'warning': return 'alert-warning'
|
|
case 'info':
|
|
default: return 'alert-info'
|
|
}
|
|
}
|
|
</script>
|
|
|