Fre*_*nga 5 javascript reactjs react-router
<ul className="right hide-on-med-and-down">
<li><IndexLink to="/" activeClassName="active">ABOUT</IndexLink></li>
<li><Link to="blog" activeClassName="active">BLOG</Link></li>
<li><Link to="discover" activeClassName="active">DISCOVER</Link></li>
<li><Link to="contact" activeClassName="active">CONTACT</Link></li>
</ul>
Run Code Online (Sandbox Code Playgroud)
这就是我的导航样子,当我导航到/ blog时,博客处于活动状态。但是,当我导航到/ blog / my-blog-post时,活动类消失了,有没有办法使/ blog / my-blog-post在我的博客列表项上设置活动类?
<Route path="blog" component={Blog}>
<Route path=":slug" component={Blog}></Route>
</Route>
Run Code Online (Sandbox Code Playgroud)
我只需要按照上面的方式声明我的路线就可以了!这个链接很有帮助:https://github.com/reactjs/react-router/issues/1684
| 归档时间: |
|
| 查看次数: |
1193 次 |
| 最近记录: |