arr1 = [
{
label: '系统管理',
id: 2011,
children: [
{
label: '通讯录',
id: 2012
},
{
label: '个人资料',
id: 2014
}
]
},
{
label: '客户及商机管理',
id: 2024,
children: [
{
label: '线索库',
id: 2025,
children: [
{
label: "新建线索",
id: 2031
}
]
},
{
label: "商机库",
id: 2026,
children: [
{
label: "新建线索",
id: 2031
}
]
},
{
label: "客户",
id: 2040
}
]
}
]
需要得到:
arr2 = [
{
label: '客户及商机管理',
id: 2024,
children: [
{
label: '线索库',
id: 2025,
children: [
{
label: "新建线索",
id: 2031
}
]
},
{
label: "商机库",
id: 2026,
children: [
{
label: "新建线索",
id: 2031
}
]
}
]
}
]
需要处理arr1 的第三级children有值就返回,没有就过滤掉