fix: vue-router now works (require(...).default)
This commit is contained in:
parent
3b524fbe93
commit
7363f6ea1a
|
@ -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
|
||||
|
|
|
@ -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/'
|
||||
|
|
|
@ -12,6 +12,6 @@
|
|||
<script>
|
||||
export default {
|
||||
name: 'CONTAINER_DASHBOARD',
|
||||
data(){ return { gstore: window.gstore.data }; },
|
||||
data(){ return { gstore: window.gstore.data }; }
|
||||
}
|
||||
</script>
|
|
@ -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>
|
|
@ -12,6 +12,6 @@
|
|||
<script>
|
||||
export default {
|
||||
name: 'CONTAINER_NOTIFICATIONS',
|
||||
data(){ return { gstore: window.gstore.data }; },
|
||||
data(){ return { gstore: window.gstore.data }; }
|
||||
}
|
||||
</script>
|
|
@ -12,6 +12,6 @@
|
|||
<script>
|
||||
export default {
|
||||
name: 'CONTAINER_PROFILE',
|
||||
data(){ return { gstore: window.gstore.data }; },
|
||||
data(){ return { gstore: window.gstore.data }; }
|
||||
}
|
||||
</script>
|
|
@ -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;
|
||||
|
|
|
@ -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>
|
Loading…
Reference in New Issue