Container.vue 863 B

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. <!--
  2. Container principal pour l'affichage d'une ou plusieurs alertes
  3. -->
  4. <!-- eslint-disable vue/valid-v-for -->
  5. <template>
  6. <main class="alertContainer">
  7. <client-only>
  8. <LayoutAlertContent
  9. v-for="(alert, index) in alerts"
  10. :key="index"
  11. :alert="alert"
  12. class="alertContent"
  13. />
  14. </client-only>
  15. </main>
  16. </template>
  17. <script setup lang="ts">
  18. import { computed } from 'vue'
  19. import type { Alert } from '~/types/interfaces'
  20. import { usePageStore } from '~/stores/page'
  21. const pageStore = usePageStore()
  22. // Using alerts in the template's v-for directive
  23. const alerts = computed<Array<Alert>>(() => pageStore.alerts)
  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>