现在想把articesList设置为默认路由,点击AppSider里的文章标签去articlesList路由,点击ArticlesList里的文章进入articleDetail路由App.js<Layout className="app-container">
<AppSider />
<AppContent /></Layout>AppContentclass AppContent extends React.Component {
render() { return (
<Content className="app-content bg-fff">
<Switch>
<Route path="/articleDetail" component={ArticleDetail} />
<Route path='/articlesList/:tag' component={ArticlesList} />
</Switch>
</Content>
)
}
}
2 回答
慕后森
TA贡献1802条经验 获得超5个赞
let Routes = (<Router> <div> <Link activeClassName="active" exact={true} to={{pathname: '/index'}}>首页</Link> <div className="route-content"> <Switch> <Redirect path="/" to={{pathname: '/index'}} /> </Switch> </div> </div></Router>)
exact配合Redirect就可以了
添加回答
举报
0/150
提交
取消