var arrs=[];
function getinfo(items) {
for (var item of items){
if (item.children){
arrs.push({
id: item.id,
parentid:item.parentId,
name:item.title,
children:getinfo(item.children)
}
)
}else {
arrs.push({
id: item.id,
parentid:item.parentId,
name:item.title
}
)
}
}
}
数据结构如下:
{
id: 13,
parentId: -1,
children: [
{
id: 5,
parentId: 13,
children: [
{
id: 1,
parentId: 5,
children: [],
icon: "fa-user",
title: "用户管理",
href: "/admin/user",
spread: false,
path: "/adminSys/baseManager/userManager",
code: "userManager"
}
]
icon: "setting", title: "基础配置管理", href: "/admin", spread: false, path: "/adminSys/baseManager", code: "baseManager"
}]
,
icon: "setting",
title: "权限管理系统",
href: "/base",
spread: false,
path: "/adminSys",
code: "adminSys"
}