Container.vue 916 B

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