diff --git a/web/client/src/layout/index.js b/web/client/src/layout/index.js index a59df43..5c28d62 100644 --- a/web/client/src/layout/index.js +++ b/web/client/src/layout/index.js @@ -31,37 +31,38 @@ const Root = props => { function flat(routes, parentRoute) { routes.forEach((route, i) => { - let obj = { + const obj = { path: route.path, breadcrumb: route.breadcrumb, component: route.component || null, authCode: route.authCode || '', - key: route.key - } - if (!route.path.startsWith("/")) { - console.error('路由配置需以 "/" 开始:' + route.path); + key: route.key, + }; + if (!route.path.startsWith('/')) { + console.error(`路由配置需以 "/" 开始:${route.path}`); } if (route.path.length > 1 && route.path[route.path.length] == '/') { - console.error('除根路由路由配置不可以以 "/" 结束:' + route.path); + console.error(`除根路由路由配置不可以以 "/" 结束:${route.path}`); } if (parentRoute && parentRoute != '/') { obj.path = parentRoute + route.path; } - if (route.exact) { - obj.exact = true + if (route.exact === false) { + obj.exact = false; } if (route.hasOwnProperty('childRoutes')) { combineRoutes.push(obj); - flat(route.childRoutes, obj.path) + flat(route.childRoutes, obj.path); } else { - combineRoutes.push(obj) + combineRoutes.push(obj); } - }) + }); } flat(routes); return combineRoutes; - } + }; + const initReducer = (reducers, reducerName, action) => { let reducerParams = {} @@ -90,7 +91,7 @@ const Root = props => { let actions = { layout: layoutActions } - + for (let s of sections) { if (!s.key) console.warn('请给你的section添加一个key值,section name:' + s.name); for (let r of s.routes) { @@ -141,7 +142,7 @@ const Root = props => { setCombineRoutes(combineRoutes.map(route => (