
// 路由设置

import iceRoutes from '../router.js' // 飞冰二次开发生成的路由
import routes from './menus.js'
import syncComponents from './components.js'
import asyncComponents from './asyncComponents.js'

const components = Object.assign(syncComponents, asyncComponents)

const routers = JSON.parse(JSON.stringify(routes))

const attachComp = arr => {
  arr.forEach(item => {
    if (typeof item.component === 'string' && components[item.component]) {
      item.component = components[item.component].default || components[item.component]
    }
    if (item.children && item.children.length) {
      attachComp(item.children)
    }
  })
}
attachComp(routers)
window.routes = routers.concat(iceRoutes)
export default routers.concat(iceRoutes)
