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 */
Vue.use(VueRouter);
window.router = new VueRouter({
const router = new VueRouter({
mode: 'history',
routes: routes[0]
});
/* (5) Render view */
new Vue({
el: '#main-vue',
router: window.router,
el: '#main-vue',
router,
render: h => h(wrapper_vue)
})
});
/* (3) Set WebSocket channels

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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