fix: vue-router now works (require(...).default)

This commit is contained in:
xdrm-brackets 2017-12-05 08:39:24 +01:00
parent 3b524fbe93
commit 7363f6ea1a
8 changed files with 27 additions and 29 deletions

View File

@ -29,17 +29,18 @@ window.infobox = new InfoBox(window.gstore.data.info);
/* (4) Init vue router */ /* (4) Init vue router */
Vue.use(VueRouter); Vue.use(VueRouter);
window.router = new VueRouter({ const router = new VueRouter({
mode: 'history', mode: 'history',
routes: routes[0] routes: routes[0]
}); });
/* (5) Render view */ /* (5) Render view */
new Vue({ new Vue({
el: '#main-vue', el: '#main-vue',
router: window.router, router,
render: h => h(wrapper_vue) render: h => h(wrapper_vue)
}) });
/* (3) Set WebSocket channels /* (3) Set WebSocket channels

View File

@ -2,16 +2,16 @@ export default { 0: [
{ {
path: '/dashboard/', path: '/dashboard/',
component: require('./vue/container/dashboard.vue') component: require('./vue/container/dashboard.vue').default
}, { }, {
path: '/profile/', path: '/profile/',
component: require('./vue/container/profile.vue') component: require('./vue/container/profile.vue').default
}, { }, {
path: '/message/', path: '/inbox/',
component: require('./vue/container/message.vue') component: require('./vue/container/inbox.vue').default
}, { }, {
path: '/notifications/', path: '/notifications/',
component: require('./vue/container/notifications.vue') component: require('./vue/container/notifications.vue').default
}, { }, {
path: '*', path: '*',
redirect: '/dashboard/' redirect: '/dashboard/'

View File

@ -12,6 +12,6 @@
<script> <script>
export default { export default {
name: 'CONTAINER_DASHBOARD', name: 'CONTAINER_DASHBOARD',
data(){ return { gstore: window.gstore.data }; }, data(){ return { gstore: window.gstore.data }; }
} }
</script> </script>

View File

@ -14,7 +14,7 @@
<script> <script>
export default { export default {
name: 'CONTAINER_MSG', name: 'CONTAINER_INBOX',
data(){ return { gstore: window.gstore.data }; }, data(){ return { gstore: window.gstore.data }; }
} }
</script> </script>

View File

@ -12,6 +12,6 @@
<script> <script>
export default { export default {
name: 'CONTAINER_NOTIFICATIONS', name: 'CONTAINER_NOTIFICATIONS',
data(){ return { gstore: window.gstore.data }; }, data(){ return { gstore: window.gstore.data }; }
} }
</script> </script>

View File

@ -12,6 +12,6 @@
<script> <script>
export default { export default {
name: 'CONTAINER_PROFILE', name: 'CONTAINER_PROFILE',
data(){ return { gstore: window.gstore.data }; }, data(){ return { gstore: window.gstore.data }; }
} }
</script> </script>

View File

@ -24,7 +24,8 @@ export default {
// (1) Update URL // (1) Update URL
console.log('Loading page \''+page+'\''); console.log('Loading page \''+page+'\'');
window.history.pushState(page, page, '/'+page+'/'); console.log(this.$router)
this.$router.push('/'+page);
// (2) Activate current element // (2) Activate current element
this.gstore.menu_item_active = page; this.gstore.menu_item_active = page;

View File

@ -14,22 +14,18 @@
</template> </template>
<script> <script>
import header_vue from './header.vue'; import header_vue from './header.vue'
import menu_vue from './menu.vue'; import menu_vue from './menu.vue'
export default { export default {
name: 'wrapper', name: 'wrapper',
data(){ return { data(){ return { gstore: window.gstore.data }; },
gstore: window.gstore.data components: {
}; }, 'HeaderComp': header_vue,
components: { 'MenuComp': menu_vue
'HeaderComp': header_vue, }
'MenuComp': menu_vue
} }
}
</script> </script>