twitter-bootstrap-3 – Yii 2中的多级Boostrap菜单

我希望我的菜单有超过2个级别.看起来Yii 2只能渲染2级.例如:

NavBar::begin();

echo Nav::widget([
    'options' => ['class' => 'navbar-nav navbar-right'],'items' => [
        [
            'label' => 'Level 1','items' => [
                ['label' => 'Level 2 - 1','url' => '#'],['label' => 'Level 2 - 2',[
                    'label' => 'Level 2 - 3','items' => [
                        ['label' => 'Level 3 - 1',['label' => 'Level 3 - 2',],]
        ],]);

NavBar::end();

不会显示Level 3 – x菜单项.如何在菜单添加更多级别?

解决方法

这不是Yii 2的限制,它是Boostrap 3的限制.

以下是mdo(Boostrap 3主要贡献者之一)的引用:

We haven’t seen anyone using submenus in meaningful ways and the code
necessary to make them work well is just too much overhead. Submenus
just don’t have much of a place on the web right Now,especially the
mobile web. They will be removed with 3.0.

它取自here.

但是,您可以找到一些替代方案来使用更多级别.比如看看这个extension.

此问题也将在更多细节和示例here中进行讨论.

相关文章

Bootstrip HTML 查询搜索常用格式模版 <form class=&...
如何在按钮上加红色数字 您可以使用Bootstrap的badge组件来在...
要让两个按钮左右排列,你可以使用 Bootstrap 的网格系统将它...
是的,可以将status设置为布尔类型,这样可以在前端使用复选...
前端工程师一般用的是Bootstrap的框架而不是样式,样式一般自...
起步导入:<linkrel="stylesheet"href="b...