fix allow route management only in dev env

This commit is contained in:
Revantant 2019-07-15 18:12:03 +08:00
parent 55a2deace8
commit 13f597b3dd
1 changed files with 20 additions and 9 deletions

View File

@ -167,15 +167,6 @@ export const asyncRoutes = [
title: 'Role Permission', title: 'Role Permission',
roles: ['admin'] roles: ['admin']
} }
},
{
path: 'path',
component: () => import('@/views/permission/route'),
name: 'Route',
meta: {
title: 'Route',
roles: ['admin']
}
} }
] ]
}, },
@ -404,6 +395,26 @@ const createRouter = () => new Router({
const router = createRouter() const router = createRouter()
if (process.env.NODE_ENV === 'development') {
router.addRoutes([
{
path: '/',
component: Layout,
redirect: '/dashboard',
children: [
{
path: 'route',
component: () => import('@/views/permission/route'),
name: 'Route',
meta: {
title: 'Route',
roles: ['admin']
}
}
]
}])
}
// Detail see: https://github.com/vuejs/vue-router/issues/1234#issuecomment-357941465 // Detail see: https://github.com/vuejs/vue-router/issues/1234#issuecomment-357941465
export function resetRouter() { export function resetRouter() {
const newRouter = createRouter() const newRouter = createRouter()