Container.vue 815 B

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. <!--
  2. Container principal pour l'affichage d'une ou plusieurs alertes
  3. -->
  4. <template>
  5. <main class="alertContainer">
  6. <client-only>
  7. <LayoutAlertContent
  8. v-for="(alert, key) in alerts"
  9. :key="key"
  10. :alert="alert"
  11. class="alertContent"
  12. />
  13. </client-only>
  14. </main>
  15. </template>
  16. <script setup lang="ts">
  17. import type { Alert } from '~/types/interfaces'
  18. import { usePageStore } from '~/stores/page'
  19. import type { ComputedRef } from '@vue/reactivity'
  20. const pageStore = usePageStore()
  21. const alerts: ComputedRef<Array<Alert>> = computed(() => {
  22. return pageStore.alerts
  23. })
  24. </script>
  25. <style scoped>
  26. .alertContainer {
  27. position: fixed;
  28. bottom: 0;
  29. right: 20px;
  30. z-index: 1000;
  31. }
  32. .alertContainer > .alertContent {
  33. position: relative;
  34. margin-bottom: 10px;
  35. }
  36. </style>