【发布时间】:2016-08-09 16:39:28
【问题描述】:
我有两条路线:
/resource/1/
/resource/1/nested_resource/2
以及适当的<Link /> 组件。
当我去路由/resource/1/-只有转发到/resource/1/ 的链接有active 类。
但是当我转到/resource/1/nested_resource/2 路径时,/resource/1/ 和/resource/1/nested_resource/2 的链接有活动课程。
在第二种情况下,有没有办法只为嵌套路由链接(如/resource/1/nested_resource/2)提供活动类?
<Route path='/' component={Layout}>
<IndexRoute component={Index} />
<Route path='resource' >
<IndexRoute component={Resources} onEnter={onEnter} />
<Route path='new' component={NewResource} />
<Route path=':resourceId' onEnter={onEnter}>
<IndexRoute component={ShowResource} onEnter={onEnter} />
<Route path='nested_resource' >
<Route path=':nestedResourceId' component={NestedResource} />
<Route path='new' component={NestedResourceNew} />
</Route>
</Route>
</Route>
</Route>
【问题讨论】:
标签: javascript reactjs redux react-router