From 7363f6ea1adeda6ad54816cb925271246af15f42 Mon Sep 17 00:00:00 2001 From: xdrm-brackets Date: Tue, 5 Dec 2017 08:39:24 +0100 Subject: [PATCH] fix: vue-router now works (require(...).default) --- view/main.js | 9 +++---- view/routes.js | 10 ++++---- view/vue/container/dashboard.vue | 2 +- view/vue/container/{message.vue => inbox.vue} | 4 ++-- view/vue/container/notifications.vue | 2 +- view/vue/container/profile.vue | 2 +- view/vue/menu.vue | 3 ++- view/vue/wrapper.vue | 24 ++++++++----------- 8 files changed, 27 insertions(+), 29 deletions(-) rename view/vue/container/{message.vue => inbox.vue} (78%) diff --git a/view/main.js b/view/main.js index 7f099df..beddbed 100755 --- a/view/main.js +++ b/view/main.js @@ -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 diff --git a/view/routes.js b/view/routes.js index 6820dcf..2b77d41 100644 --- a/view/routes.js +++ b/view/routes.js @@ -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/' diff --git a/view/vue/container/dashboard.vue b/view/vue/container/dashboard.vue index 6fc5afe..38aaa1c 100644 --- a/view/vue/container/dashboard.vue +++ b/view/vue/container/dashboard.vue @@ -12,6 +12,6 @@ \ No newline at end of file diff --git a/view/vue/container/message.vue b/view/vue/container/inbox.vue similarity index 78% rename from view/vue/container/message.vue rename to view/vue/container/inbox.vue index 9dab11f..d2dda18 100644 --- a/view/vue/container/message.vue +++ b/view/vue/container/inbox.vue @@ -14,7 +14,7 @@ \ No newline at end of file diff --git a/view/vue/container/notifications.vue b/view/vue/container/notifications.vue index a032520..387662b 100644 --- a/view/vue/container/notifications.vue +++ b/view/vue/container/notifications.vue @@ -12,6 +12,6 @@ \ No newline at end of file diff --git a/view/vue/container/profile.vue b/view/vue/container/profile.vue index a61c94a..998cef4 100644 --- a/view/vue/container/profile.vue +++ b/view/vue/container/profile.vue @@ -12,6 +12,6 @@ \ No newline at end of file diff --git a/view/vue/menu.vue b/view/vue/menu.vue index 46940fc..286fe20 100644 --- a/view/vue/menu.vue +++ b/view/vue/menu.vue @@ -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; diff --git a/view/vue/wrapper.vue b/view/vue/wrapper.vue index 3d24162..cc25e66 100755 --- a/view/vue/wrapper.vue +++ b/view/vue/wrapper.vue @@ -14,22 +14,18 @@ - - - \ No newline at end of file