10.10综合交易所原始源码-管理后台
1
zj
2 days ago a27825570e9c2d0053c634ecd081cd9871a31b49
src/views/main-navbar.vue
@@ -521,19 +521,25 @@
      ) {
        searchAll = JSON.parse(sessionStorage.getItem("menuList"));
      }
      // 过滤数组并生成新的数组对象
      //console.log(searchAll);
      if (searchAll.length > 0) {
        this.restaurants = searchAll.flatMap((menuItem) => {
          return menuItem.orderNum > 0 && menuItem.list
            ? menuItem.list
                .filter((item) => item.url.trim() !== "")
                .map((item) => ({
                  value: item.name,
                  url: item.url,
                }))
            : [];
        const items = [];
        const walk = (nodes) => {
          if (!nodes) return;
          nodes.forEach((node) => {
            if (node.url && node.url.trim() !== "") {
              items.push({ value: node.name, url: node.url });
            }
            if (node.list && node.list.length) {
              walk(node.list);
            }
          });
        };
        searchAll.forEach((root) => {
          if (root.orderNum > 0) {
            walk(root.list || []);
          }
        });
        this.restaurants = items;
      }
    },
  },