Usando vuex

This commit is contained in:
Alejandro Tasistro 2025-05-23 01:02:11 -03:00
parent 5458fae6d9
commit a9ca04811e

View file

@ -1,32 +1,19 @@
<template>
<div v-show="aprobado" class="notification is-warning has-text-centered">
<div v-if="aprobado" class="notification is-warning has-text-centered">
Tu pedido fue <strong>aprobado</strong>, por lo que no puede ser modificado
</div>
</template>
<script>
export default {
data() {
return {
aprobado: false,
}
},
mounted() {
Event.$on('pedido-actualizado', this.actualizarEstado);
if (this.$root.pedido != null) {
this.actualizarEstado();
}
},
methods: {
pedidoAprobado: function() {
return this.$root.pedido.aprobado;
},
actualizarEstado: function() {
this.aprobado = this.pedidoAprobado();
},
},
import { mapState } from "vuex";
export default {
name: 'CartelPedidoAprobado',
computed: {
...mapState('pedido',["aprobado"]),
}
}
</script>
<style>
</style>
</style>