腾讯云优惠券
呆错后台管理框架基础模块(前台导航)开发实例
人气:497 更新:2022-02-27

初始字段

$fields = [
    'navs_id'      => 'term_id',
    'navs_parent'  => 'term_parent',//父级ID
    'navs_name'    => 'term_name',//名称
    'navs_url'     => 'term_slug',//链接
    'navs_type'    => 'term_type',//类型(navbar|sitebar|nav|link|ico|image|other)
    'navs_info'    => 'term_info',//描述
    'navs_active'  => 'term_title',//高亮
    'navs_ico'     => 'term_keywords',//图标class
    'navs_image'   => 'term_description',//小图片或图标地址
    'navs_status'  => 'term_status',//状态(public|private|normal|hidden)
    'navs_order'   => 'term_order',//排序(越大越前)
    'navs_target'  => 'term_action',//打开方式
    'navs_controll'=> 'term_controll',//固定值(navs)
    'navs_module'  => 'term_module',//应用名
    'navs_link'    => '',//真实访问链接,不需要录入
];

卸载插件时删除前台导航菜单

model('common/Navs','loglic')->uninstall('demo');

安装插件时批量添加一级导航菜单

model('common/Navs','loglic')->install([
    [
        'navs_name'       => '菜单1',
        'navs_url'        => 'demo/index/index',
        'navs_module'     => 'demo',
        'navs_type'       => 'navbar',//导航栏
    ],
    [
        'navs_name'       => '菜单2',
        'navs_url'        => 'https://www.daicuo.org',
        'navs_module'     => 'demo',
        'navs_type'       => 'navbar',//导航栏
        'navs_target'     => '_blank',
    ],
]);

安装插件时批量添加二级导航菜单

model('common/Navs','loglic')->install([
    [
        'navs_name'       => '菜单3',
        'navs_url'        => 'demo/index/index',
        'navs_module'     => 'demo',
        'navs_type'       => 'navbar',//导航栏
    ],
    [
        'navs_name'       => '菜单4',
        'navs_url'        => 'demo/index/index',
        'navs_module'     => 'demo',
        'navs_type'       => 'navbar',//导航栏
        'navs_target'     => '_blank',
    ],
],'菜单1');