Joh*_*ohn 5 reactjs react-router
我用react开发了一个页面,其路线是
http://example.come/page1
加载网址后,我需要在网址末尾添加斜杠,如下所示
http://example.come/page1/
我的路线是这样的
Router history={browserHistory}>
<Route path='/' component={Home} />
<Route path='/page1' component={Page1} />
</Router>
Run Code Online (Sandbox Code Playgroud)
我尝试将路径直接更改为“/page1/”而不是“/page1”,但这不会加载http://example.com/page1,它只会打开http://example.com/page1/
我想要加载Page1组件的路径
根据此回复,https://github.com/ReactTraining/react-router/issues/820#issuecomment-256814655
hooks (onEnter and onChange)与v2 或更高版本一起使用react-router可能会达到您的需求。
| 归档时间: |
|
| 查看次数: |
7533 次 |
| 最近记录: |