asyncRouter.js 342 B

12345678910111213
  1. const _import = require('./_import') // 获取组件的方法
  2. export const asyncRouterHandle = (asyncRouter) => {
  3. asyncRouter.map(item => {
  4. if (item.component) {
  5. item.component = _import(item.component)
  6. } else {
  7. delete item['component']
  8. }
  9. if (item.children) {
  10. asyncRouterHandle(item.children)
  11. }
  12. })
  13. }