J
J
j0ker132017-10-16 13:27:04
Vue.js
j0ker13, 2017-10-16 13:27:04

How to remake navigation in vuejs?

There is a small admin panel. users are divided into 2 ranks: admin, user.
The router did this:

Vue.use(Router)

function view (name) {
  return function (resolve) {
    let rank = store.getters.getRank
    require(['../components/' + rank + '/' + name], resolve)
  }
};

export default new Router({
  mode: 'history',
  linkActiveClass: 'is-active',
  routes: [
    {
      path: '/',
      components: {
        navbar: view('Navbar'),
        content: view('Dashboard')
      },
      meta: {
        requiresAuth: true
      }
    }
  ... 
})

and, accordingly, the components are divided into admin, user folders.
if you go under the admin and then under the user - the navbar component is displayed from the admin. When you refresh the page everything is ok.
how to update routers or suggest another navigation architecture with separation of components.

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question