Add a handler for the state changes
This commit is contained in:
parent
86acbe62e4
commit
7e2c53dfc4
1 changed files with 16 additions and 4 deletions
20
src/App.vue
20
src/App.vue
|
|
@ -15,17 +15,17 @@
|
|||
/>
|
||||
<Join-Or-Host
|
||||
v-else-if="state == 'game-type'"
|
||||
@go-to="state = $event"
|
||||
@go-to="go_to"
|
||||
@alert="alert = $event"
|
||||
/>
|
||||
<Game-Code
|
||||
v-else-if="state == 'game-code'"
|
||||
@go-to="state = $event"
|
||||
@go-to="go_to"
|
||||
@alert="alert = $event"
|
||||
/>
|
||||
<Game-Lobby
|
||||
v-else-if="state == 'lobby'"
|
||||
@go-to="state = $event"
|
||||
@go-to="go_to"
|
||||
@alert="alert = $event"
|
||||
/>
|
||||
</div>
|
||||
|
|
@ -71,7 +71,19 @@ export default {
|
|||
classes: []
|
||||
},
|
||||
}},
|
||||
methods: {},
|
||||
methods: {
|
||||
go_to(state) {
|
||||
if (this.alert.message) {
|
||||
setTimeout(() => {
|
||||
this.alert = {
|
||||
message: ``,
|
||||
classes: [],
|
||||
};
|
||||
}, 5000);
|
||||
};
|
||||
this.state = state;
|
||||
},
|
||||
},
|
||||
sockets: {
|
||||
disconnect() {
|
||||
this.alert = {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue