我希望我的菜单有超过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();
解决方法
这不是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中进行讨论.
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。