QQ扫一扫联系
在 Core/ModuleServiceProvider.php
中配置,通过如下方式注册菜单:
AdminMenu::register(function () {
return [
[
// 菜单标题
'title' => '一级菜单',
// 导航图标,可从以下图标 class 值,如 list 或 fa fa-search
// → 基础图标 https://modstart.com/ui/manual/icon
// → Font Awesome 图标 https://modstart.com/ui/manual/icon_fa
'icon' => 'tools',
// 菜单排序
'sort' => 150,
// 菜单子菜单
'children' => [
[
'title' => '二级菜单',
// 菜单链接 Controller 和 Action
'url' => '\Module\Xxx\Admin\Controller\XxxController@index',
]
]
],
[
'title' => '一级菜单',
'icon' => 'tools',
'sort' => 150,
'children' => [
[
'title' => '二级菜单',
'children' => [
[
'title' => '三级菜单',
'url' => '\Module\Xxx\Admin\Controller\XxxController@index',
],
[
'title' => '三级菜单',
'url' => '\Module\Xxx\Admin\Controller\XxxController@index',
]
],
]
]
],
];
});
ModStart系统按照如下相同的规则进行菜单合并:
如需要隐藏某一个菜单不显示在菜单栏但出现在权限管理中,只需要给菜单项增加参数,如下
// ...
[
'title' => '二级菜单',
'url' => '\Module\Xxx\Admin\Controller\XxxController@index',
// 增加该参数不会显示在菜单栏
'hide' => true,
]
// ...