@/api/user#getCurrentUserNav JavaScript Examples
The following examples show how to use
@/api/user#getCurrentUserNav.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: generator-routers.js From vue-antdesign-admin-template with MIT License | 6 votes |
generatorDynamicRouter = (token) => {
return new Promise((resolve, reject) => {
getCurrentUserNav({ token })
.then((res) => {
console.log('res', res)
const { result } = res
const menuNav = []
const childrenNav = []
// 后端数据, 根级树数组, 根级 PID
listToTree(result, childrenNav, 0)
rootRouter.children = childrenNav
menuNav.push(rootRouter)
console.log('menuNav', menuNav)
const routers = generator(menuNav)
routers.push(notFoundRouter)
console.log('routers', routers)
resolve(routers)
})
.catch((err) => {
reject(err)
})
})
}