【发布时间】:2015-12-25 00:19:32
【问题描述】:
所以我找到了这个Navigation Bar feature with Bootstrap-3,但现在我使用的是 Flow-Router 而不是 Iron-Router。因此,我正在寻求将此辅助函数转换为 Flow-Router 术语:
Template.navItems.helpers({
activeIfTemplateIs: function (template) {
var currentRoute = Router.current();
return currentRoute &&
template === currentRoute.lookupTemplate() ? 'active' : '';
}
});
我已经自己尝试解决了这个问题(虽然没有费心对其进行测试,因为我的网站/应用程序的许多部分仍然无法运行),但我需要以“是”或“的形式进行确认不”,也许还有更多关于我做错了什么的信息。
Template.navItems.helpers({
activeIfTemplateIs: function (template) {
var currentRoute = FlowRouter.current();
return currentRoute &&
template === currentRoute.name ? 'active' : '';
}
});
我从Flow-Router API 引导自己。这个解决方案是正确的,还是出于某种原因,它必须与 Iron-Router 一起使用?
【问题讨论】:
标签: meteor twitter-bootstrap-3 iron-router flow-router