Sharkey/src/client/app/mobile/views/pages/reversi.vue

51 lines
938 B
Vue
Raw Normal View History

2018-03-07 10:55:02 +01:00
<template>
<mk-ui>
2018-06-17 01:10:54 +02:00
<span slot="header">%fa:gamepad%リバーシ</span>
<mk-reversi v-if="!fetching" :init-game="game" @gamed="onGamed"/>
2018-03-07 10:55:02 +01:00
</mk-ui>
</template>
<script lang="ts">
import Vue from 'vue';
2018-03-09 17:48:16 +01:00
import Progress from '../../../common/scripts/loading';
2018-03-07 10:55:02 +01:00
export default Vue.extend({
2018-03-09 17:48:16 +01:00
data() {
return {
fetching: false,
game: null
};
},
watch: {
$route: 'fetch'
},
created() {
this.fetch();
},
2018-03-07 10:55:02 +01:00
mounted() {
2018-06-17 01:10:54 +02:00
document.title = 'Misskey リバーシ';
2018-03-07 10:55:02 +01:00
document.documentElement.style.background = '#fff';
2018-03-09 17:48:16 +01:00
},
methods: {
fetch() {
if (this.$route.params.game == null) return;
Progress.start();
this.fetching = true;
2018-07-07 12:01:33 +02:00
(this as any).api('games/reversi/games/show', {
2018-03-29 07:48:47 +02:00
gameId: this.$route.params.game
2018-03-09 17:48:16 +01:00
}).then(game => {
this.game = game;
this.fetching = false;
Progress.done();
});
},
onGamed(game) {
2018-06-17 01:10:54 +02:00
history.pushState(null, null, '/reversi/' + game.id);
2018-03-09 17:48:16 +01:00
}
2018-03-07 10:55:02 +01:00
}
});
</script>