[Client] Use dynamic import to reduce bundle size

This commit is contained in:
syuilo 2018-11-06 15:37:41 +09:00
parent fb8af53751
commit 6d67cd07a0
No known key found for this signature in database
GPG Key ID: BDC4C49D06AB9D69
4 changed files with 12 additions and 5 deletions

View File

@ -40,7 +40,6 @@ import twitterSetting from './twitter-setting.vue';
import githubSetting from './github-setting.vue';
import fileTypeIcon from './file-type-icon.vue';
import emoji from './emoji.vue';
import Reversi from './games/reversi/reversi.vue';
import welcomeTimeline from './welcome-timeline.vue';
import uiInput from './ui/input.vue';
import uiButton from './ui/button.vue';
@ -95,7 +94,6 @@ Vue.component('mk-twitter-setting', twitterSetting);
Vue.component('mk-github-setting', githubSetting);
Vue.component('mk-file-type-icon', fileTypeIcon);
Vue.component('mk-emoji', emoji);
Vue.component('mk-reversi', Reversi);
Vue.component('mk-welcome-timeline', welcomeTimeline);
Vue.component('ui-input', uiInput);
Vue.component('ui-button', uiButton);

View File

@ -1,7 +1,7 @@
<template>
<mk-window ref="window" width="500px" height="560px" :popout-url="popout" @closed="destroyDom">
<span slot="header" :class="$style.header"><fa icon="gamepad"/>%i18n:@game%</span>
<mk-reversi :class="$style.content" @gamed="g => game = g"/>
<x-reversi :class="$style.content" @gamed="g => game = g"/>
</mk-window>
</template>
@ -10,6 +10,9 @@ import Vue from 'vue';
import { url } from '../../../config';
export default Vue.extend({
components: {
XReversi: () => import('../../../common/views/components/games/reversi/reversi.vue')
},
data() {
return {
game: null

View File

@ -1,6 +1,6 @@
<template>
<component :is="ui ? 'mk-ui' : 'div'">
<mk-reversi :game-id="$route.params.game" @nav="nav" :self-nav="false"/>
<x-reversi :game-id="$route.params.game" @nav="nav" :self-nav="false"/>
</component>
</template>
@ -8,6 +8,9 @@
import Vue from 'vue';
export default Vue.extend({
components: {
XReversi: () => import('../../../../common/views/components/games/reversi/reversi.vue')
},
props: {
ui: {
default: false

View File

@ -1,7 +1,7 @@
<template>
<mk-ui>
<span slot="header"><span style="margin-right:4px;"><fa icon="gamepad"/></span>%i18n:@reversi%</span>
<mk-reversi :game-id="$route.params.game" @nav="nav" :self-nav="false"/>
<x-reversi :game-id="$route.params.game" @nav="nav" :self-nav="false"/>
</mk-ui>
</template>
@ -9,6 +9,9 @@
import Vue from 'vue';
export default Vue.extend({
components: {
XReversi: () => import('../../../../common/views/components/games/reversi/reversi.vue')
},
mounted() {
document.title = `${(this as any).os.instanceName} %i18n:@reversi%`;
},