Answer the question
In order to leave comments, you need to log in
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
}
}
...
})
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question