F web fix bug

pull/22/head
雷二猛 2019-12-06 14:28:09 +08:00
parent 991ffdad88
commit 5ef550160c
1 changed files with 3 additions and 3 deletions

View File

@ -6,7 +6,7 @@ import styles from './libs.module.css';
// 创建单个路由 // 创建单个路由
export function makeRoute(path, component) { export function makeRoute(path, component) {
return {path, component} return {subPath: path, component}
} }
// 创建模块路由 // 创建模块路由
@ -40,7 +40,7 @@ export class Router extends React.Component {
initialRoutes() { initialRoutes() {
for (let moduleRoute of moduleRoutes) { for (let moduleRoute of moduleRoutes) {
for (let route of moduleRoute['routes']) { for (let route of moduleRoute['routes']) {
route['fullPath'] = moduleRoute['prefix'] + route['path']; route['path'] = moduleRoute['prefix'] + route['subPath'];
this.routes.push(route) this.routes.push(route)
} }
} }
@ -49,7 +49,7 @@ export class Router extends React.Component {
render() { render() {
return ( return (
<Switch> <Switch>
{this.routes.map(route => <Route exact strict key={route.fullPath} {...route}/>)} {this.routes.map(route => <Route exact strict key={route.path} {...route}/>)}
<Route component={NotFound}/> <Route component={NotFound}/>
</Switch> </Switch>
) )