You should not use <Route component> and <Route children> in the same route; <Route children> will be ignored

  import Home from './programme/containers/home.jsx'
<Switch>
    <Route exact path="/login" component={Login}/>
    <Route path="/home" component={Home}>
       <Route path="/model" component={Model}/>
        <Route path="/result" component={Result}/>
    </Route>
    <Redirect from="/" to="/home" />
</Switch>

调整为

import Home from './programme/containers/home.jsx'
<Switch>
    <Route exact path="/login" component={Login}/>
    <Home>
         <Route path="/model" component={Model}/>
         <Route path="/result" component={Result}/>
    </Home>
    <Redirect from="/" to="/home" />
</Switch>

没有足够的理论知识,没有多余的解释,暂做项目问题记录

猜你喜欢

转载自www.cnblogs.com/bigsister/p/9923024.html