Ahora el dora se establece en el store en lugar del componente Juego.vue

This commit is contained in:
Araozu 2020-10-17 10:10:54 -05:00
parent bbb481ea1e
commit 02296a8d48
2 changed files with 6 additions and 12 deletions

View File

@ -1,6 +1,6 @@
<template lang="pug"> <template lang="pug">
div div
contenedor-dora(:dora="dora" :doraOculto="doraOculto" :turnosRestantes="turnosDora") contenedor-dora(:turnosRestantes="turnosDora")
div.con-int-juego div.con-int-juego
div.cont-2-juego div.cont-2-juego
div.cont-cuadrante-cartas-juego div.cont-cuadrante-cartas-juego

View File

@ -14,37 +14,31 @@ div.contenedor-dora
import {defineComponent, computed} from "vue"; import {defineComponent, computed} from "vue";
import { useDimensions } from "@/components/useDimensions"; import { useDimensions } from "@/components/useDimensions";
import carta from "@/components/carta.vue"; import carta from "@/components/carta.vue";
import { useStore } from "vuex";
export default defineComponent({ export default defineComponent({
name: "contenedor-dora", name: "contenedor-dora",
components: {carta}, components: {carta},
props: { props: {
dora: {
type: Array,
default: [0, 0, 0, 0, 0]
},
doraOculto: {
type: Array,
default: [0, 0, 0, 0, 0]
},
turnosRestantes: { turnosRestantes: {
type: Number, type: Number,
default: 32 default: 32
} }
}, },
setup(props) { setup() {
const store = useStore();
const {pH} = useDimensions(); const {pH} = useDimensions();
const pHc = computed(() => pH.value + "px"); const pHc = computed(() => pH.value + "px");
const doraCerrado = computed(() => { const doraCerrado = computed(() => {
const narr = [...props.dora]; const narr = [...store.state.dora[0]];
for (let i = narr.length; i < 5; i++) { for (let i = narr.length; i < 5; i++) {
narr.push(0); narr.push(0);
} }
return narr; return narr;
}); });
const doraAbierto = computed(() => { const doraAbierto = computed(() => {
const narr = [...props.doraOculto]; const narr = [...store.state.dora[1]];
for (let i = narr.length; i < 5; i++) { for (let i = narr.length; i < 5; i++) {
narr.push(0); narr.push(0);
} }