yii2 如何生成bootstrap 左侧导航?


类似bootstrap中文官网文档,右侧的导航是如何生成的?样式 nav bs-docs-sidenav
http://v3.bootcss.com/components/#btn-dropdowns
截图:
图片描述

yii2的main.php代码,如何填写:


 <?php

use yii\helpers\Html;
use app\assets\AppAsset;
use yii\widgets\Breadcrumbs;
use yii\bootstrap\NavBar;
use yii\bootstrap\Nav;


/* @var $this \yii\web\View */
/* @var $content string */

AppAsset::register($this);
?>
<?php $this->beginPage()?>
<!DOCTYPE html>
<?php $this->beginPage() ?>
<!DOCTYPE html>
<html lang="<?= Yii::$app->language ?>">
<head>
    <meta charset="<?= Yii::$app->charset ?>">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <?= Html::csrfMetaTags() ?>
    <title><?= Html::encode($this->title) ?>_后台_<?=Html::encode(Yii::$app->params['sitename'])?></title>
    <?php $this->head() ?>
</head>
<body>

<?php $this->beginBody() ?>

    <?php
    NavBar::begin([
        'brandLabel' => '<strong>' . Yii::$app->params['sitename'] . '</strong>',
        'brandUrl' => Yii::$app->homeUrl,
        'options' => [
            'class' => 'navbar-default navbar-fixed-top',
            'target' => '_blank',
        ],
    ]);
    ?>

    <?php NavBar::end()?>

    <?= Breadcrumbs::widget([
        'links' => isset($this->params['breadcrumbs']) ? $this->params['breadcrumbs'] : [],
    ]) ?>
    <?= $content ?>


<?php $this->endBody() ?>

</body>
</html>
<?php $this->endPage() ?>

yii2 css bootstrap

DJLubel 10 years, 1 month ago

累了,今天不想说,先占个坑。
你都找到手册了,还不知道怎么添加吗?
就是一个 nav ,加滚动监听(放在右侧是用栅格系统实现的)

http://v3.bootcss.com/javascript/#scrollspy

Easter answered 10 years, 1 month ago

Your Answer