layuiCMS2.0 左侧导航栏 生成树

json 格式

{
    "leftNavBar": [
        {
            "title": "内容管理",
            "icon": "",
            "href": "",
            "spread": false,
            "children": [
                {
                    "title": "文章列表",
                    "icon": "icon-text",
                    "href": "page/news/newsList.html",
                    "spread": false
                },
                {
                    "title": "图片管理",
                    "icon": "",
                    "href": "page/img/images.html",
                    "spread": false
                },
                {
                    "title": "404页面",
                    "icon": "",
                    "href": "page/404.html",
                    "spread": false
                },
                {
                    "title": "登录",
                    "icon": "",
                    "href": "page/login/login.html",
                    "spread": false,
                    "target": "_blank"
                }
            ]
        },
        {
            "title": "用户中心",
            "icon": "icon-icon10",
            "href": "",
            "spread": false,
            "children": [
                {
                    "title": "用户中心",
                    "icon": "",
                    "href": "page/user/userList.html",
                    "spread": false
                },
                {
                    "title": "会员等级",
                    "icon": "icon-vip",
                    "href": "page/user/userGrade.html",
                    "spread": false
                }
            ]
        },
        {
            "title": "系统设置",
            "icon": "",
            "href": "",
            "spread": false,
            "children": [
                {
                    "title": "系统基本参数",
                    "icon": "",
                    "href": "page/systemSetting/basicParameter.html",
                    "spread": false
                },{
                    "title": "系统日志",
                    "icon": "icon-log",
                    "href": "page/systemSetting/logs.html",
                    "spread": false
                },{
                    "title": "友情链接",
                    "icon": "",
                    "href": "page/systemSetting/linkList.html",
                    "spread": false
                },{
                    "title": "图标管理",
                    "icon": "",
                    "href": "page/systemSetting/icons.html",
                    "spread": false
                },
                {
                    "title": "导航管理",
                    "icon": "icon-daohang",
                    "href": "page/navs/navs_list.html",
                    "spread": false
                }
            ]
        },
        {
            "title": "使用文档",
            "icon": "icon-icon10",
            "href": "",
            "spread": false,
            "children": [
                {
                    "title": "三级联动模块",
                    "icon": "icon-mokuai",
                    "href": "page/doc/addressDoc.html",
                    "spread": false
                },{
                    "title": "bodyTab模块",
                    "icon": "icon-mokuai",
                    "href": "page/doc/bodyTabDoc.html",
                    "spread": false
                },{
                    "title": "三级菜单",
                    "icon": "icon-mokuai",
                    "href": "page/doc/navDoc.html",
                    "spread": false
                }
            ]
        }
    ]
}

数组格式


$data = array(
 'leftNavBar' => array(
                 array(
                     'title'     => '内容管理',
                     'icon'    => '',
                     'href'    => '',
                     'spread'  => false,
                     'children' =>array(
                                    array(
                                     'title'     => '文章列表',
                                     'icon'    => 'icon-text',
                                     'href'    => 'page/news/newsList.html',
                                     'spread'  => false
                                   ),
                                     array(
                                     'title'     => '图片管理',
                                     'icon'    => '',
                                     'href'    => 'page/img/images.html',
                                     'spread'  => false
                                   ),
                                     array(
                                     'title'     => '404页面',
                                     'icon'    => '',
                                     'href'    => 'page/404.html',
                                     'spread'  => false
                                   ),
                                     array(
                                     'title'     => '登录',
                                     'icon'    => '',
                                     'href'    => 'page/login/login.html',
                                     'spread'  => false,
                                     'target'  =>'_blank'
                                   )
                               )
                 ),  
                 array(
                     'title'     => '用户中心',
                     'icon'    => 'icon-icon10',
                     'href'    => '',
                     'spread'  => false,
                     'children' =>array(
                                      array(
                                       'title'     => '用户中心',
                                       'icon'    => '',
                                       'href'    => 'page/user/userList.html',
                                       'spread'  => false
                                      ), 
                                      array(
                                     'title'     => '会员等级',
                                     'icon'    => 'icon-vip',
                                     'href'    => 'page/user/userGrade.html',
                                     'spread'  => false
                                    )        
                               )
                 ),  
                 array(
                     'title'     => '系统设置',
                     'icon'    => '',
                     'href'    => '',
                     'spread'  => false,
                     'children' =>array(
                                    array(
                                     'title'     => '系统基本参数',
                                     'icon'    => '',
                                     'href'    => 'page/systemSetting/basicParameter.html',
                                     'spread'  => false
                                   ),
                                     array(
                                     'title'     => '系统日志',
                                     'icon'    => 'icon-log',
                                     'href'    => 'page/systemSetting/logs.html',
                                     'spread'  => false
                                   ),
                                     array(
                                     'title'     => '友情链接',
                                     'icon'    => '',
                                     'href'    => 'page/systemSetting/linkList.html',
                                     'spread'  => false
                                   ),
                                     array(
                                     'title'     => '图标管理',
                                     'icon'    => '',
                                     'href'    => 'page/systemSetting/icons.html',
                                     'spread'  => false,
                                   ) 
                             )
                 ),  
                 array(
                     'title'     => '使用文档',
                     'icon'    => 'icon-look',
                     'href'    => '',
                     'spread'  => false,
                     'children' =>array(
                                    array(
                                     'title'     => '三级联动模块',
                                     'icon'    => 'icon-mokuai',
                                     'href'    => 'page/doc/addressDoc.html',
                                     'spread'  => false
                                   ),
                                     array(
                                     'title'     => 'bodyTab模块',
                                     'icon'    => 'icon-mokuai',
                                     'href'    => 'page/doc/bodyTabDoc.html',
                                     'spread'  => false
                                   ),
                                     array(
                                     'title'     => '三级菜单',
                                     'icon'    => 'icon-mokuai',
                                     'href'    => 'page/doc/navDoc.html',
                                     'spread'  => false
                                   )         
                               )
                 ) 
         ) 
);

你可能感兴趣的:(layuiCMS2.0 左侧导航栏 生成树)