chore: add more composables (#138)

This commit is contained in:
Sylvain Marroufin
2023-03-09 11:42:22 +01:00
committed by GitHub
parent fef93f3198
commit fd4b608150
11 changed files with 221 additions and 71 deletions

View File

@@ -9,7 +9,7 @@
v-bind="notification"
:class="notification.click && 'cursor-pointer'"
@click="notification.click && notification.click(notification)"
@close="$toast.removeNotification(notification.id)"
@close="toast.removeNotification(notification.id)"
/>
</div>
</div>
@@ -18,10 +18,11 @@
<script setup lang="ts">
import type { ToastNotification } from '../../types'
import { useToast } from '../../composables/useToast'
import Notification from './Notification.vue'
import { useNuxtApp, useState } from '#imports'
import { useState } from '#imports'
const { $toast } = useNuxtApp()
const toast = useToast()
const notifications = useState<ToastNotification[]>('notifications', () => [])
</script>