fix: the exception when async route is not registered;🌟

修复:异步路由组件未注册时导致的异常;
This commit is contained in:
iczer 2020-08-07 09:46:14 +08:00
parent c10ea64ba7
commit 9445f0fbbb

View File

@ -14,7 +14,7 @@ function parseRoutes(routesConfig, routerMap) {
routesConfig.forEach(item => { routesConfig.forEach(item => {
// 获取注册在 routerMap 中的 router初始化 routeCfg // 获取注册在 routerMap 中的 router初始化 routeCfg
let router = undefined, routeCfg = {} let router = undefined, routeCfg = {}
if (typeof item === 'string') { if (typeof item === 'string' && routerMap[item]) {
router = routerMap[item] router = routerMap[item]
routeCfg = {path: router.path || item, router: item} routeCfg = {path: router.path || item, router: item}
} else if (typeof item === 'object') { } else if (typeof item === 'object') {