Fix for tab-elements fetching

This commit is contained in:
Kasper Rynning-Tønnesen
2020-04-03 12:35:24 +02:00
parent 14fbf40ac8
commit 6e5f99391f
3 changed files with 11 additions and 3 deletions

View File

@@ -183,9 +183,16 @@ export default {
},
beforeDestroy() {
this.setWinnerdataToStorage();
eventBus.$off("tab-change", () => {
this.fetchColorsAndWinners();
});
},
mounted() {
this.fetchColorsAndWinners();
eventBus.$on("tab-change", () => {
this.fetchColorsAndWinners();
});
},
methods: {
stringify(json) {

View File

@@ -111,6 +111,7 @@
<script>
import io from "socket.io-client";
import eventBus from "@/mixins/EventBus";
import {
addAttendee,
getVirtualWinner,

View File

@@ -7,9 +7,7 @@
:key="index"
@click="changeTab(index)"
:class="chosenTab == index ? 'active' : null"
>
{{ tab.name }}
</div>
>{{ tab.name }}</div>
</div>
<div class="tab-elements">
<component
@@ -23,6 +21,7 @@
</template>
<script>
import eventBus from "@/mixins/EventBus";
export default {
props: {
tabs: {
@@ -45,6 +44,7 @@ export default {
changeTab: function(num) {
this.chosenTab = num;
this.$emit("tabChange", num);
eventBus.$emit("tab-change");
}
}
};