From 325b423c4d1ab0fd0ee76d9f71abdf6defb57eb6 Mon Sep 17 00:00:00 2001 From: hanhh <18330117883@163.com> Date: Sun, 20 Jun 2021 22:59:03 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E6=9F=A5=E7=9C=8B=E8=84=9A?= =?UTF-8?q?=E6=9C=AC=E9=A1=B5=E6=90=9C=E7=B4=A2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/pages/script/index.tsx | 22 ++-------------------- 1 file changed, 2 insertions(+), 20 deletions(-) diff --git a/src/pages/script/index.tsx b/src/pages/script/index.tsx index d049066d..8d84a0a4 100644 --- a/src/pages/script/index.tsx +++ b/src/pages/script/index.tsx @@ -7,32 +7,16 @@ import { request } from '@/utils/http'; import styles from './index.module.less'; function getFilterData(keyword: string, data: any) { - const expandedKeys: string[] = []; if (keyword) { const tree: any = []; data.forEach((item: any) => { if (item.title.toLocaleLowerCase().includes(keyword)) { tree.push(item); - expandedKeys.push(...item.children.map((x: any) => x.key)); - } else { - const children: any[] = []; - (item.children || []).forEach((subItem: any) => { - if (subItem.title.toLocaleLowerCase().includes(keyword)) { - children.push(subItem); - } - }); - if (children.length > 0) { - tree.push({ - ...item, - children, - }); - expandedKeys.push(...children.map((x) => x.key)); - } } }); - return { tree, expandedKeys }; + return { tree }; } - return { tree: data, expandedKeys }; + return { tree: data }; } const Script = () => { @@ -65,8 +49,6 @@ const Script = () => { }; const onSelect = (value: any, node: any) => { - console.log(value); - console.log(node); setSelect(value); setTitle(node.parent || node.value); getDetail(node);