简体   繁体   English

使用Sammy.js忽略部分参考

[英]Ignore section reference with Sammy.js

Twitter bootstrap accordion not working with Sammy.js Twitter引导手风琴无法与Sammy.js一起使用

Is a similar question but was never answered. 是一个类似的问题,但从未得到回答。

I am creating an affixed Twitter Bootstrap side nav-list and using has based href's but when I click on them Sammy is trying to catch the routes. 我正在创建一个附加的Twitter Bootstrap侧面导航列表,并使用具有基于href的href,但是当我单击它们时,Sammy试图抓住路线。 Since I am dynamically creating the Id's and href's I can prevent them from ever matching an existing route but it constantly hits the console with errors. 由于我是动态创建Id和href的,因此可以防止它们与现有路由匹配,但是它会不断在控制台上出错。 I am sure in production they won't show up but is there anything that can be done to prevent this? 我确信在生产中它们不会出现,但是有什么办法可以防止这种情况发生?

        <ul class="nav nav-list affix">
            <!-- ko foreach: sections -->
                <li class="nav-header"><span data-bind="text: navDesc"></span></li>
                    <!-- ko foreach: paragraphs -->
                    <li><a data-bind="attr: { href: '#' + navProp() }"><span data-bind="text: navDesc"></span> <i class="icon-chevron-right"></i></a></li>
                    <!-- /ko -->
            <!-- /ko -->
        </ul>

I know this will be fixed in the next version of Durandal but just checking any other options. 我知道在下一版的Durandal中将解决此问题,但仅检查其他任何选项即可。

Durandal 1.2 provides a guardRoute method, which will allow you to intercept the call before it reaches sammy. Durandal 1.2提供了guardRoute方法,该方法可让您在呼叫到达guardRoute之前拦截该呼叫。

Check out How to handle / ignore a bad route with durandal? 查看如何处理/忽略durandal的错误路线? for more information. 欲获得更多信息。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM