kartik-v/yii2-bootstrap4-dropdown
Composer 安装命令:
composer require kartik-v/yii2-bootstrap4-dropdown
包简介
Enhanced Bootstrap 4.x dropdown widget for Yii2 with nested submenu support
README 文档
README
yii2-bootstrap4-dropdown
Enhanced Bootstrap 4.x dropdown widget for Yii2 framework with nested submenu support.
Docs & Demo
You can see detailed docs & demos and the API code documentation on usage of the extension.
Installation
The preferred way to install this extension is through composer.
NOTE: Check the composer.json for this extension's requirements and dependencies. Read this web tip /wiki on setting the
minimum-stabilitysettings for your application's composer.json.
Either run
$ php composer.phar require kartik-v/yii2-bootstrap4-dropdown "@dev"
or add
"kartik-v/yii2-bootstrap4-dropdown": "@dev"
to the require section of your composer.json file.
Usage
Dropdown Menu NavBar
use yii\bootstrap4\NavBar; use yii\bootstrap4\Nav; use kartik\bs4dropdown\Dropdown; use yii\helpers\Html; NavBar::begin(['brandLabel' => 'NavBar Test']); echo Nav::widget([ 'items' => [ ['label' => 'Home', 'url' => ['/site/index']], [ 'label' => 'Dropdown', 'items' => [ ['label' => 'Section 1', 'url' => '/'], ['label' => 'Section 2', 'url' => '#'], [ 'label' => 'Section 3', 'items' => [ ['label' => 'Section 3.1', 'url' => '/'], ['label' => 'Section 3.2', 'url' => '#'], [ 'label' => 'Section 3.3', 'items' => [ ['label' => 'Section 3.3.1', 'url' => '/'], ['label' => 'Section 3.3.2', 'url' => '#'], ], ], ], ], ], ], ['label' => 'About', 'url' => ['/site/about']], ], 'dropdownClass' => Dropdown::classname(), // use the custom dropdown 'options' => ['class' => 'navbar-nav mr-auto'], ]); NavBar::end(); <div class="dropdown"> <?php echo Html::button('Dropdown Button', [ 'id' => 'dropdownMenuButton', 'class' => 'btn btn-secondary dropdown-toggle' 'data-toggle' => 'dropdown', 'aria-haspopup' => 'true', 'aria-expanded' => 'false' ]); echo Dropdown::widget([ 'items' => [ ['label' => 'Section 1', 'url' => '/'], ['label' => 'Section 2', 'url' => '#'], [ 'label' => 'Section 3', 'items' => [ ['label' => 'Section 3.1', 'url' => '/'], ['label' => 'Section 3.2', 'url' => '#'], [ 'label' => 'Section 3.3', 'items' => [ ['label' => 'Section 3.3.1', 'url' => '/'], ['label' => 'Section 3.3.2', 'url' => '#'], ], ], ], ], ], 'options' => ['aria-labelledby' => 'dropdownMenuButton'] ]); ?> </div>
Dropdown Solo Button
<?php use \yii\helpers\Html; use kartik\bs4dropdown\Dropdown; ?> <div class="dropdown"> <?php echo Html::button('Dropdown Button', [ 'id' => 'dropdownMenuButton', 'class' => 'btn btn-secondary dropdown-toggle' 'data-toggle' => 'dropdown', 'aria-haspopup' => 'true', 'aria-expanded' => 'false' ]); echo Dropdown::widget([ 'items' => [ ['label' => 'Section 1', 'url' => '/'], ['label' => 'Section 2', 'url' => '#'], [ 'label' => 'Section 3', 'items' => [ ['label' => 'Section 3.1', 'url' => '/'], ['label' => 'Section 3.2', 'url' => '#'], [ 'label' => 'Section 3.3', 'items' => [ ['label' => 'Section 3.3.1', 'url' => '/'], ['label' => 'Section 3.3.2', 'url' => '#'], ], ], ], ], ], 'options' => ['aria-labelledby' => 'dropdownMenuButton'] ]); ?> </div>
Dropdown Button Alt (using ButtonDropdown)
use \yii\helpers\Html; use kartik\bs4dropdown\ButtonDropdown; echo ButtonDropdown::widget([ 'label' => 'Dropdown Button', 'dropdown' => [ 'items' => [ ['label' => 'Section 1', 'url' => '/'], ['label' => 'Section 2', 'url' => '#'], [ 'label' => 'Section 3', 'items' => [ ['label' => 'Section 3.1', 'url' => '/'], ['label' => 'Section 3.2', 'url' => '#'], [ 'label' => 'Section 3.3', 'items' => [ ['label' => 'Section 3.3.1', 'url' => '/'], ['label' => 'Section 3.3.2', 'url' => '#'], ], ], ], ], ], ], 'buttonOptions' => ['class'=>'btn-secondary'] ]);
License
yii2-bootstrap4-dropdown is released under the BSD-3-Clause License. See the bundled LICENSE.md for details.
kartik-v/yii2-bootstrap4-dropdown 适用场景与选型建议
kartik-v/yii2-bootstrap4-dropdown 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 2.15M 次下载、GitHub Stars 达 9, 最近一次更新时间为 2018 年 08 月 10 日, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「jquery」 「bootstrap」 「dropdown」 「yii2」 「nested」 「submenu」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 kartik-v/yii2-bootstrap4-dropdown 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 kartik-v/yii2-bootstrap4-dropdown 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 kartik-v/yii2-bootstrap4-dropdown 相关的其它包
同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:
Bootstrap dropdown list with AJAX data.
Yii2 LightBox image galary widget uses Lightbox v2.10.0 by Lokesh Dhakar
A simple state dropdown field for SilverStripe forms
Use JSON templates as field options for dropdown, radio or checkboxes.
A Laravel Nova Multiselect Dropdown Field.
AssetBundle for https://cameronspear.com/demos/bootstrap-hover-dropdown/
统计信息
- 总下载量: 2.15M
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 9
- 点击次数: 26
- 依赖项目数: 18
- 推荐数: 4
其他信息
- 授权协议: BSD-3-Clause
- 更新时间: 2018-08-10