johnproza/yii2-menu

动态菜单

安装: 20

依赖项: 0

建议者: 0

安全: 0

星标: 0

关注者: 2

分支: 1

开放问题: 0

类型:yii2-extension

dev-master 2020-06-04 10:32 UTC

This package is auto-updated.

Last update: 2024-09-04 20:14:18 UTC


README

动态菜单和HTML内容,配合TinyMCE编辑器

您还可以将菜单分配给项目(动态和静态菜单)

安装

安装此扩展的首选方式是通过 composer

运行以下命令:

php composer.phar require --prefer-dist johnproza/yii2-menu "*"

或者

"johnproza/yii2-menu": "*"

将以下内容添加到您的 composer.json 文件的 require 部分:

使用方法

在使用之前,您必须准备数据库

php yii migrate --migrationPath=@vendor/johnproza/yii2-menu/migrations 

配置扩展

在您的代码中使用它

'menu' => [
    'class' => 'oboom\menu\Module',
]

小部件使用

将以下内容插入到视图文件中,以在前端显示菜单

use oboom\menu\widgets\Menu;
.....
.....
<?=Menu::widget([
    'menuId'=>1, // menu id
    'itemId'=>$item->id, // id of item. This is check, how to assign menu into item 
    'level'=>1, //menu level
    'className'=>'header' // css class name
]) ?>

将以下内容插入到视图文件中,以在后台显示分类

use oboom\menu\widgets\MenuList;
.....
.....
<?=MenuList::widget()?>