作者:mobiledu2502857407 | 来源:互联网 | 2023-08-04 20:19
1、easyuizTreeThinkPHP6修改zTree默认显示name字段2、ThinkPHP6后台代码获取菜单jsonpublicfunctionmenu(){$dataD
1、easyui + zTree +ThinkPHP6 修改zTree默认显示name字段
2、ThinkPHP6后台代码
//获取菜单jsonpublic function menu(){ $data = Db::name('auth_rule')->where('menu_id','0')->select(); return json_encode($data);}
打印的json内容:
[
{
"id": 0,
"name": "index",
"title": "系统管理",
"status": 1,
"condition": "",
"type": 1,
"create_time": null,
"update_time": null,
"class": null,
"icon": "/static/zTree_v3/css/zTreeStyle/img/diy/1_open.png",
"menu_id": "0"
},
{
"id": 1,
"name": "menu/index",
"title": "菜单-列表",
"status": 1,
"condition": "",
"type": 1,
"create_time": 1583675725,
"update_time": 1583999174,
"class": "menu",
"icon": "/static/zTree_v3/css/zTreeStyle/img/diy/5.png",
"menu_id": "0"
},
{
"id": 6,
"name": "admin/index",
"title": "管理员-列表",
"status": 1,
"condition": "",
"type": 1,
"create_time": 1583989284,
"update_time": 1583989284,
"class": "admin",
"icon": "/static/zTree_v3/css/zTreeStyle/img/diy/5.png",
"menu_id": "0"
},
{
"id": 11,
"name": "authgroup/index",
"title": "管理组-列表",
"status": 1,
"condition": "",
"type": 1,
"create_time": 1583989284,
"update_time": 1583989284,
"class": "authgroup",
"icon": "/static/zTree_v3/css/zTreeStyle/img/diy/5.png",
"menu_id": "0"
},
{
"id": 16,
"name": "authrule/index",
"title": "权限规则-列表",
"status": 1,
"condition": "",
"type": 1,
"create_time": 1583989284,
"update_time": 1583989284,
"class": "authrule",
"icon": "/static/zTree_v3/css/zTreeStyle/img/diy/5.png",
"menu_id": "0"
}
]
引入easyui、zTree相关js、css
3、主页布局
{include file="/public/header"}
4、运行