加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 综合聚焦 > 服务器 > 安全 > 正文

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

发布时间:2020-12-17 21:33:47 所属栏目:安全 来源:网络整理
导读:我希望我的菜单有超过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' = '
我希望我的菜单有超过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中进行讨论.

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读