使用Meteor和Iron Router创建活动的导航状态 [英] Creating active navigation state with Meteor and Iron Router
本文介绍了使用Meteor和Iron Router创建活动的导航状态的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我想在Iron Router当前正在渲染的导航列表项中添加活动"类.
I want to add a class of 'active' to the nav list item that is currently being rendered by Iron Router.
这是我的标记:
<ul>
<li>
{{#linkTo route="option1"}}
<span class="fa fa-fw fa-option"></span>
Option 1
{{/linkTo}}
</li><li>
{{#linkTo route="option2"}}
<span class="fa fa-fw fa-option"></span>
Option 2
{{/linkTo}}
</li>
</ul>
我已经通读了指南和各种文章,但是找不到任何地方涉及到它.假设我需要某种帮手?
I've read through the guide and various articles but can't find this covered anywhere. Assuming I'll need some sort of helper?
推荐答案
我认为您可能会找到 meteor-iron- router-active 有用,因为它具有以下帮助器:
I think you might find meteor-iron-router-active useful, as it has helpers for the following:
- isActiveRoute
- isActivePath
- isActiveRoute
- isActivePath
这篇关于使用Meteor和Iron Router创建活动的导航状态的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文