pedi2/resources/js/components/NavMigas.vue

54 lines
1.1 KiB
Vue
Raw Normal View History

2022-05-25 19:03:29 -03:00
<template>
2023-05-27 15:33:08 -03:00
<nav class="breadcrumb is-centered has-background-danger-light is-fixed-top" aria-label="breadcrumbs" v-show="visible">
<ul class="mt-4">
<li v-for="(miga, i) in migas" :key="i" :class="{'is-active': i == migaActiva}">
<a :href="miga.href" v-text="miga.nombre"
:class="{'has-text-danger': i != migaActiva}"></a>
</li>
</ul>
</nav>
2022-05-25 19:03:29 -03:00
</template>
<script>
export default {
data() {
return {
migas: []
}
},
computed: {
visible: function() {
return this.migas.length > 0
2023-05-27 15:33:08 -03:00
},
migaActiva: function() {
return this.migas.length-1
}
2022-05-25 19:03:29 -03:00
},
mounted() {
Event.$on('migas-setear-como-inicio', (miga) => {
this.migas = [];
this.migas.push(miga);
});
Event.$on('migas-agregar', (miga) => {
this.migas.push(miga);
});
Event.$on('migas-reset', () => {
this.migas = [];
});
Event.$on('migas-pop', () => {
this.migas.pop();
});
}
}
</script>
<style>
nav.breadcrumb.is-fixed-top {
position: fixed;
2023-05-27 15:33:08 -03:00
left: 0;
2022-05-25 19:03:29 -03:00
right: 0;
top: 3.25rem;
2023-05-27 15:33:08 -03:00
height: 2.75rem;
z-index: 5;
2022-05-25 19:03:29 -03:00
}
</style>