【发布时间】:2016-05-08 11:46:36
【问题描述】:
我用react-router 配置了这条路线:
render((
<Router history={browserHistory}>
<Route path="/" component={PoApp}>
<IndexRoute component={Home} />
<Route name="category" path="notices/:category" component={Category}>
<Route name="notice" path=":id" component={Content} />
<IndexRoute component={Home} />
</Route>
</Route>
</Router>
), document.getElementById('poApp'));
对于/ 和notices/:category 工作正常
但对于 :id(即 /notices/:category/:id),它仍会加载 Category 组件。怎么了?
如果我不清楚,我在这里举一些应该如何工作的例子:
/ => PoApp
/notices/cars => 类别
/notices/cars/2 => 内容
【问题讨论】:
标签: javascript reactjs react-router