动态menu和角色关联
This commit is contained in:
@@ -16,15 +16,25 @@ export const router = {
|
||||
actions: {
|
||||
// 从后台获取动态路由
|
||||
async SetAsyncRouter({ commit }) {
|
||||
const baseRouter = [{
|
||||
path: '/layout',
|
||||
name: 'layout',
|
||||
component: "view/layout/index.vue",
|
||||
meta: {
|
||||
title: "底层layout"
|
||||
},
|
||||
children: []
|
||||
}]
|
||||
const asyncRouterRes = await asyncMenu()
|
||||
const asyncRouter = asyncRouterRes.data.menus
|
||||
asyncRouter.push({
|
||||
baseRouter[0].children = asyncRouter
|
||||
baseRouter.push({
|
||||
path: '*',
|
||||
redirect: '/404'
|
||||
|
||||
})
|
||||
asyncRouterHandle(asyncRouter)
|
||||
commit('setAsyncRouter', asyncRouter)
|
||||
asyncRouterHandle(baseRouter)
|
||||
commit('setAsyncRouter', baseRouter)
|
||||
}
|
||||
},
|
||||
getters: {
|
||||
|
||||
Reference in New Issue
Block a user