✌️
This commit is contained in:
parent
cb0a0a7aa4
commit
cbcf3fd7f1
8 changed files with 79 additions and 121 deletions
|
|
@ -34,7 +34,7 @@ import MkMessagingRoom from './views/pages/messaging-room.vue';
|
|||
import MkNote from './views/pages/note.vue';
|
||||
import MkSearch from './views/pages/search.vue';
|
||||
import MkTag from './views/pages/tag.vue';
|
||||
import MkReversi from './views/pages/reversi.vue';
|
||||
import MkReversi from './views/pages/games/reversi.vue';
|
||||
import MkShare from './views/pages/share.vue';
|
||||
import MkFollow from '../common/views/pages/follow.vue';
|
||||
|
||||
|
|
@ -65,8 +65,11 @@ init(async (launch) => {
|
|||
{ path: '/search', component: MkSearch },
|
||||
{ path: '/tags/:tag', component: MkTag },
|
||||
{ path: '/share', component: MkShare },
|
||||
{ path: '/reversi', component: MkReversi },
|
||||
{ path: '/reversi/:game', component: MkReversi },
|
||||
{ path: '/reversi', component: MkReversi,
|
||||
children: [{
|
||||
path: ':game', component: MkReversi
|
||||
}]
|
||||
},
|
||||
{ path: '/@:user', component: MkUser },
|
||||
{ path: '/notes/:note', component: MkNote },
|
||||
{ path: '/authorize-follow', component: MkFollow }
|
||||
|
|
|
|||
22
src/client/app/desktop/views/pages/games/reversi.vue
Normal file
22
src/client/app/desktop/views/pages/games/reversi.vue
Normal file
|
|
@ -0,0 +1,22 @@
|
|||
<template>
|
||||
<component :is="ui ? 'mk-ui' : 'div'">
|
||||
<mk-reversi :game-id="$route.params.game" @nav="nav"/>
|
||||
</component>
|
||||
</template>
|
||||
|
||||
<script lang="ts">
|
||||
import Vue from 'vue';
|
||||
|
||||
export default Vue.extend({
|
||||
props: {
|
||||
ui: {
|
||||
default: false
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
nav(game) {
|
||||
history.pushState(null, null, '/reversi/' + game.id);
|
||||
},
|
||||
}
|
||||
});
|
||||
</script>
|
||||
|
|
@ -1,50 +0,0 @@
|
|||
<template>
|
||||
<component :is="ui ? 'mk-ui' : 'div'">
|
||||
<mk-reversi v-if="!fetching" :init-game="game" @gamed="onGamed"/>
|
||||
</component>
|
||||
</template>
|
||||
|
||||
<script lang="ts">
|
||||
import Vue from 'vue';
|
||||
import Progress from '../../../common/scripts/loading';
|
||||
|
||||
export default Vue.extend({
|
||||
props: {
|
||||
ui: {
|
||||
default: false
|
||||
}
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
fetching: false,
|
||||
game: null
|
||||
};
|
||||
},
|
||||
watch: {
|
||||
$route: 'fetch'
|
||||
},
|
||||
created() {
|
||||
this.fetch();
|
||||
},
|
||||
methods: {
|
||||
fetch() {
|
||||
if (this.$route.params.game == null) return;
|
||||
|
||||
Progress.start();
|
||||
this.fetching = true;
|
||||
|
||||
(this as any).api('games/reversi/games/show', {
|
||||
gameId: this.$route.params.game
|
||||
}).then(game => {
|
||||
this.game = game;
|
||||
this.fetching = false;
|
||||
|
||||
Progress.done();
|
||||
});
|
||||
},
|
||||
onGamed(game) {
|
||||
history.pushState(null, null, '/reversi/' + game.id);
|
||||
}
|
||||
}
|
||||
});
|
||||
</script>
|
||||
Loading…
Add table
Add a link
Reference in a new issue