const meuns = [ // { // pagePath: "/pages/supervision/supervision", // icon: "grid", // url: "/mobile/supervision" // }, { pagePath: "/pages/inspector/inspector", icon: "eye", url: "/mobile/inspector" } ]; export const filterMenu = (menuList) => { const list = []; if (menuList && menuList.length) { menuList.forEach(v => { const item = meuns.find(vv => vv.url == v.url); if (item != null) { list.push({ name: v.name, url: v.url, icon: item.icon, pagePath: item.pagePath }); } if (v.children && v.children.length) { const childList = filterMenu(v.children); if (childList.length) { //console.log("=============>", childList) list.push(...childList); } } }) } return list; };