{"size": 1075, "ext": "js", "max_stars_repo_path": "GQA-FRONTEND/src/utils/router.js", "max_stars_repo_name": "aehm2k5/gin-quasar-admin", "max_stars_repo_stars_event_min_datetime": null, "max_stars_repo_stars_event_max_datetime": null, "max_issues_repo_path": "GQA-FRONTEND/src/utils/router.js", "max_issues_repo_name": "aehm2k5/gin-quasar-admin", "max_issues_repo_issues_event_min_datetime": "2021-11-15T07:31:24.000Z", "max_issues_repo_issues_event_max_datetime": "2022-03-29T07:24:25.000Z", "max_forks_repo_path": "GQA-FRONTEND/src/utils/router.js", "max_forks_repo_name": "aehm2k5/gin-quasar-admin", "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null}
{"max_stars_count": null, "max_issues_count": 66, "max_forks_count": null, "avg_line_length": 29.8611111111, "max_line_length": 73, "alphanum_fraction": 0.4930232558}
import { PrivateRoutes } from 'src/router/routes'

export const HandleRouter = (menuData) => {
    const result = []
    for (let item of menuData) {
        if (item.path !== '' && item.component) {
            const obj = {
                path: item.path,
                name: item.name,
                component: pageImporter(item.component),
                meta: {
                    hidden: item.hidden,
                    keepAlive: item.keepAlive,
                    title: item.title,
                    icon: item.icon,
                }
            }
            result.push(obj)
        } else {
            if (item.isLink === "yes") {
                delete item.path
            }
        }
    }
    // 将需要鉴权路由的children（默认是空的）替换成后台传过来的整理后的路由表
    PrivateRoutes[0].children = [...result]
    // 返回鉴权路由
    return PrivateRoutes
}

const pageImporter = (component) => {
    // Quasar2 版本:
    return () => Promise.resolve(require(`src/${component}.vue`).default)
    // Quasar1 版本:
    // return (resolve) => require([`src/pages/${component}`], resolve)
}