adds simple global state, adds dropdown to switch players

This commit is contained in:
2019-06-11 22:08:53 +02:00
parent 4454bd245c
commit feef8146d2
3 changed files with 84 additions and 31 deletions

View File

@@ -3,19 +3,7 @@
<section id="content" class="columns is-desktop">
<Player></Player>
<div class="column">
<section id="main" class="columns">
<div class="column">
<div id="main-heading" class="columns is-mobile is-vcentered">
<div class="column is-narrow">
<span class="icon is-large"><i class="fas fa-3x fa-gem"></i></span>
</div>
<div class="column has-text-left">
<h1 class="title">Coffre de groupe</h1>
</div>
</div>
<Chest player_id="0"></Chest>
</div>
</section>
<GroupChest></GroupChest>
</div>
</section>
</main>
@@ -23,14 +11,30 @@
<script>
import Player from './components/Player.vue'
import Chest from './components/Chest.vue'
import GroupChest from './components/GroupChest.vue'
import 'bulma/css/bulma.css'
export const store = {
debug: true,
state: {
player_id: 0,
show_player_chest: false,
},
setActivePlayer (newPlayerId) {
if (this.debug) console.log('setActivePlayer to ', newPlayerId)
this.state.player_id = newPlayerId
},
switchPlayerChestVisibility () {
if (this.debug) console.log('switchPlayerChestVisibility', !this.state.show_player_chest)
this.state.show_player_chest = !this.state.show_player_chest
}
}
export default {
name: 'app',
components: {
Player,
Chest
GroupChest
}
}
</script>