menuMap.js 802 B

12345678910111213141516171819202122232425262728293031323334353637
  1. const meuns = [
  2. // {
  3. // pagePath: "/pages/supervision/supervision",
  4. // icon: "grid",
  5. // url: "/mobile/supervision"
  6. // },
  7. {
  8. pagePath: "/pages/inspector/inspector",
  9. icon: "eye",
  10. url: "/mobile/inspector"
  11. }
  12. ];
  13. export const filterMenu = (menuList) => {
  14. const list = [];
  15. if (menuList && menuList.length) {
  16. menuList.forEach(v => {
  17. const item = meuns.find(vv => vv.url == v.url);
  18. if (item != null) {
  19. list.push({
  20. name: v.name,
  21. url: v.url,
  22. icon: item.icon,
  23. pagePath: item.pagePath
  24. });
  25. }
  26. if (v.children && v.children.length) {
  27. const childList = filterMenu(v.children);
  28. if (childList.length) {
  29. //console.log("=============>", childList)
  30. list.push(...childList);
  31. }
  32. }
  33. })
  34. }
  35. return list;
  36. };