pedi2/resources/js/components/CategoriasContainer.vue

41 lines
1.3 KiB
Vue
Raw Normal View History

2022-05-25 19:03:29 -03:00
<template>
<div v-show="visible" class="container">
<div class="columns is-multiline is-mobile">
2023-05-27 14:23:52 -03:00
<div v-for="(categoria,i) in categorias" :key="i" class="block column is-one-quarter-desktop is-one-third-tablet is-half-mobile">
<div @click.capture="seleccionarCategoria(categoria)" class="card" style="height:100%" >
2022-05-25 19:03:29 -03:00
<div class="card-content">
<div class="media">
<div class="media-content" style="overflow:hidden">
2023-05-27 14:23:52 -03:00
<p class="title is-6" v-text="categoria"></p>
2022-05-25 19:03:29 -03:00
</div>
</div>
</div>
</div><!-- END CARD -->
</div><!-- END BLOCK COLUMN -->
</div><!-- END COLUMNS -->
</div><!-- END CONTAINER -->
</template>
<script>
export default {
data() {
return {
categorias: null,
2023-05-27 15:33:08 -03:00
visible: true
2022-05-25 19:03:29 -03:00
}
},
mounted() {
axios.get("/api/categorias").then(response => {
this.categorias = response.data;
});
2023-05-27 15:33:08 -03:00
Event.$emit("migas-setear-como-inicio", this.$rootMiga);
2023-05-27 14:23:52 -03:00
Event.$on("categoria-seleccionada", (_) => this.visible = false)
2022-05-25 19:03:29 -03:00
},
methods: {
seleccionarCategoria(categoria) {
this.visible = false;
2023-05-27 14:23:52 -03:00
Event.$emit("categoria-seleccionada",'categoria',categoria);
2022-05-25 19:03:29 -03:00
}
}
}
</script>