Container.vue 923 B

12345678910111213141516171819202122232425262728293031323334353637383940414243
  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 v-for directive
  23. // eslint-disable-next-line @typescript-eslint/no-unused-vars
  24. const alerts = computed<Array<Alert>>(() => pageStore.alerts)
  25. </script>
  26. <style scoped>
  27. .alertContainer {
  28. position: fixed;
  29. bottom: 0;
  30. right: 20px;
  31. z-index: 1000;
  32. }
  33. .alertContainer > .alertContent {
  34. position: relative;
  35. margin-bottom: 10px;
  36. }
  37. </style>