Koha/koha-tmpl/intranet-tmpl/prog/js/vue/components/ERM/Breadcrumb.vue
Jonathan Druart b6c0c6c9d3
Bug 32030: Improve breadcrumb (again)
Signed-off-by: Jonathan Field <jonathan.field@ptfs-europe.com>

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
2022-11-08 09:44:06 -03:00

31 lines
No EOL
901 B
Vue

<template>
<nav id="breadcrumbs" aria-label="Breadcrumb" class="breadcrumb">
<ol>
<li v-for="(item, counter) in breadCrumbs" v-bind:key="counter">
<router-link
v-if="!item.path && counter == breadCrumbs.length - 1"
:to="`${currentRoute}`"
>
{{ $t(item.text) }}</router-link
>
<router-link v-else :to="item.path">
{{ $t(item.text) }}</router-link
>
</li>
</ol>
</nav>
</template>
<script>
import { useRouter } from 'vue-router'
export default {
computed: {
breadCrumbs() {
if (this.$route.meta.breadcrumb) {
return this.$route.meta.breadcrumb()
}
},
currentRoute: () => useRouter().currentRoute.value.path
},
};
</script>