3

我正在尝试使用子菜单制作菜单,但没有运气:

<ul class="side-menu">
    {{#link-to 'reportSummary' tagName="li" href=false}}<a href="#"><span class="badge pull-right">17</span> <i class="icon-dashboard"></i>Рабочий стол</a>{{/link-to}}
    {{#link-to 'remarkList' tagName="li" href=false}}
        <a href="#"><span class="badge pull-right">17</span> <i class="icon-bar-chart"></i>Замечания</a>
        <ul class="sub-menu">
            {{#link-to 'remarkState' 'review' tagName="li" href=false}}<a href="#"><i class="icon-angle-right"></i>Исполнение</a>{{/link-to}}
            {{#link-to 'remarkState' 'approval' tagName="li" href=false}}<a href="#"><i class="icon-angle-right"></i>Утверждение</a>{{/link-to}}
            {{#link-to 'remarkState' 'worker' tagName="li" href=false}}<a href="#"><i class="icon-angle-right"></i>Объяснительная</a>{{/link-to}}
            {{#link-to 'remarkState' 'info' tagName="li" href=false}}<a href="#"><i class="icon-angle-right"></i>Информация</a>{{/link-to}}
            {{#link-to 'myRemarks' tagName="li" href=false}}<a href="#"><i class="icon-angle-right"></i>Мои замечания</a>{{/link-to}}
        </ul>
    {{/link-to}}
    {{#link-to 'refusalList' tagName="li" href=false}}<a href="#"><span class="badge pull-right">17</span> <i class="icon-terminal"></i>Отказы</a>{{/link-to}}
    {{#link-to 'complaintList' tagName="li" href=false}}<a href="#"><span class="badge pull-right">17</span> <i class="icon-th"></i>Жалобы</a>{{/link-to}}
</ul>

当我单击嵌套链接时,它根本不起作用,没有事件。怎么了?

4

1 回答 1

3

不要嵌套你的链接。链接到帮助器使用一个特殊的视图,LinkView,并使用它的点击事件来调用转换。当您嵌套两个这样的视图时,单击事件会通过两者冒泡,从而使外部视图事件(称为最后一个)成为重要事件。

相反,您应该执行以下操作:

                    {{#link-to 'remarkList' tagName="li" href=false}}
                        <a href="#"><span class="badge pull-right">17</span> <i class="icon-bar-chart"></i>Замечания</a>
                    {{/link-to}}
                    <ul class="sub-menu">
                        {{#link-to 'remarkState' 'review' tagName="li" href=false}}<a href="#"><i class="icon-angle-right"></i>Исполнение</a>{{/link-to}}
                        {{#link-to 'remarkState' 'approval' tagName="li" href=false}}<a href="#"><i class="icon-angle-right"></i>Утверждение</a>{{/link-to}}
                        {{#link-to 'remarkState' 'worker' tagName="li" href=false}}<a href="#"><i class="icon-angle-right"></i>Объяснительная</a>{{/link-to}}
                        {{#link-to 'remarkState' 'info' tagName="li" href=false}}<a href="#"><i class="icon-angle-right"></i>Информация</a>{{/link-to}}
                        {{#link-to 'myRemarks' tagName="li" href=false}}<a href="#"><i class="icon-angle-right"></i>Мои замечания</a>{{/link-to}}
                    </ul>

将每个链接指向特定元素。

于 2013-09-17T07:28:10.730 回答