gin-vue-admin 2.0代码重构
This commit is contained in:
13
web/src/utils/asyncRouter.js
Normal file
13
web/src/utils/asyncRouter.js
Normal file
@@ -0,0 +1,13 @@
|
||||
const _import = require('./_import') //获取组件的方法
|
||||
export const asyncRouterHandle = (asyncRouter) => {
|
||||
asyncRouter.map(item => {
|
||||
if (item.component) {
|
||||
item.component = _import(item.component)
|
||||
} else {
|
||||
delete item['component']
|
||||
}
|
||||
if (item.children) {
|
||||
asyncRouterHandle(item.children)
|
||||
}
|
||||
})
|
||||
}
|
Reference in New Issue
Block a user