CommonBackButton.vue 741 B

12345678910111213141516171819202122232425262728
  1. <!-- Copyright (C) 2012-2023 Zammad Foundation, https://zammad-foundation.org/ -->
  2. <script setup lang="ts">
  3. import type { RouteLocationRaw } from 'vue-router'
  4. interface Props {
  5. fallback: RouteLocationRaw
  6. label?: string
  7. // list of routes users shouldn't go back to
  8. // useful, if there is a possible infinite loop
  9. // ticket -> information -> ticket -> information -> ...
  10. ignore?: string[]
  11. }
  12. defineProps<Props>()
  13. </script>
  14. <template>
  15. <button
  16. class="flex cursor-pointer items-center"
  17. :aria-label="$t('Go back')"
  18. :class="{ 'gap-2': label }"
  19. @click="$walker.back(fallback, ignore)"
  20. >
  21. <CommonIcon decorative name="mobile-chevron-left" />
  22. <span v-if="label">{{ $t(label) }}</span>
  23. </button>
  24. </template>