eseperio/yii2-bigmenu-widget
Composer 安装命令:
composer require eseperio/yii2-bigmenu-widget
包简介
A yii2 pure CSS multilevel menu. With option to load views inside menu via ajax.
README 文档
README
Any code contribution is welcome
Bigmenu renders a PURE CSS multilevel menu with advanced functions. It works like default nav widget, but dropdowns are
pure css. It also allows large menu items loaded vía ajax using page parameter. It has no limit on levels, but be
careful. A lot of levels are uncomfortable for users.
Installation
composer require eseperio/yii2-bigmenu-widget
When an item have page property and items, the first one will be available on medium-large devices meanwhile on
second will be available on mobile devices.
echo Bigmenu::widget([ 'items' => [ [ 'label' => 'Home', 'url' => ['site/index'], 'linkOptions' => [...], ], [ 'label' => 'Multilevel', 'items' => [ ['label' => 'Level 1 - Dropdown A', 'url' => '#'], '<li class="divider"></li>', '<li class="dropdown-header">Dropdown Header</li>', ['label' => 'Level 1 - Dropdown B', 'url' => '#'], ], ], [ 'label' => 'Login', 'url' => ['site/login'], 'visible' => Yii::$app->user->isGuest ], [ 'label' => 'Login', 'url' => ['site/login'], 'visible' => Yii::$app->user->isGuest, 'page' => ['site/menu'] ], ], 'options' => ['class' =>'nav-pills'], // set this to nav-tab to get tab-styled navigation 'jsOptions' => ['widthToEnableResponsive'=> 768], // set this to override the options used in js ]);
How to use
This widget is based on yii/bootstrap/nav widget yii\bootstrap\nav. The main differences are:
- Allows infinite multilevel. For a better usability don´t use more than 3 levels.
- Allow render a page as a menu panel. With this you are free to make complex and advanced dropdowns menus.
- Render of pages in menu is made with ajax, and only one request is made per panel.
To use as simple multilevel pass an array to items property. See yii\bootstrap\nav documentation.
Dynamic panels
To use dynamic panels add to the menu item the property "page". This must be a link to the action that renders the page.
Bigmenu::widget([
'hamburger' => "slide",
'items' => [
['label'=>"Dynamic content", "url"=>["site/index"], "page"=>["site/samplemenupage"] ],
...
]
])
In your controller use eseperio\yii2-bigmenu\widget\BigmenuTrait. Then in your action, to render content
call $this->renderBigmenu($view,$options).
Note: The trait only simplifies the task of differenciating render method, between render and renderAjax. So you can
do this in your own controller if you don´t want to use traits.
Change hamburger
This widget implements Hamburgers by jonsuh. You can change the hamburger like this
Bigmenu::widget([
'hamburger' => "slide",
'items' => [...]
])
Change width to enable responsive
If you want custom the with of the responsive devise, you must set the property jsOptions
Bigmenu::widget([
'jsOptions' => ['widthToEnableResponsive'=> 992],
'items' => [...]
])
Screenshots
This first screenshot shows a view rendered and loaded vía ajax automatically with this widget.
Mobile friendly

eseperio/yii2-bigmenu-widget 适用场景与选型建议
eseperio/yii2-bigmenu-widget 是一款 基于 SCSS 开发的 Composer 扩展包,目前已累计 915 次下载、GitHub Stars 达 5, 最近一次更新时间为 2017 年 09 月 04 日, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「menu」 「css」 「html」 「ajax」 「widget」 「big」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 eseperio/yii2-bigmenu-widget 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 eseperio/yii2-bigmenu-widget 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 eseperio/yii2-bigmenu-widget 相关的其它包
同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:
Texy converts plain text in easy to read Texy syntax into structurally valid (X)HTML. It supports adding of images, links, nested lists, tables and has full support for CSS. Texy supports hyphenation of long words (which reflects language rules), clickable emails and URL (emails are obfuscated again
A Twig extension to insert css as inline styles with a tag
Caching and compression for Twig assets (JavaScript and CSS).
A Symfony extension to get active class base on current bundle/controller/action
HTML and form generation
Define your own css rule-sets for the TYPO3 CMS backend.
统计信息
- 总下载量: 915
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 5
- 点击次数: 14
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2017-09-04