<Switch>
<Redirect from="/" to="/light/login" exact></Redirect>
<Route path="/light/login" component={Login}></Route>
<Route path="/light/index" component={Index}></Route>
<Route path="/404" component={NotFound}></Route>
<Redirect from="*" to="/404" exact></Redirect>
</Switch>
二级路由需要同样的配置:
listDom.push(<Redirect key="404" from="*" to="/404" exact></Redirect>)
<div className="m-list">
<Header></Header>
<div className="m-list-info">
<Nav></Nav>
<Suspense fallback={<Loading isLazyLoading={true}></Loading>}>
<Switch>
{listDom}
</Switch>
</Suspense>
</div>
</div>