zoukankan      html  css  js  c++  java
  • yii2.0 面包屑的使用

    yii2中面包屑是yii2自带的小部件,类似本网站的导航栏应该就是采用面包屑来完成的

    QQ截图20160802150327.png

     例子如下,需要引入 yiiwidgetsBreadcrumbs

    echo Breadcrumbs::widget([
        'homeLink' => ['label' => '首页', 'url' => ['site/index']],
        'itemTemplate' => "

    • {link}
    • ", //全局模板  运用到每个link
          'links' => [
              [
                  'label' => '文章列表',
                  'url' => ['site/index'],
                  'template' => "
    • {link}
    • " //只会引用到该类模板
              ],
              [
                  'label' => '文章详情',
                  'url' => ['site/view', 'id'=>1]//如果需要传参这种格式
              ],
              '编辑',//没有链接的

        ],
        'options' => [//设置html属性
            'class' => ''
        ]
    ]);
    ?>

    注意:如果加入options可能会导致样式覆盖,达不到你想要的效果

  • 相关阅读:
    SpringMVC扩展
    反射机制
    python day9
    python day8
    python day7
    python day6
    python day4
    python day3
    python day2
    python day1
  • 原文地址:https://www.cnblogs.com/Pxhphp/p/6237276.html
Copyright © 2011-2022 走看看