mirror of
https://github.com/whyour/qinglong.git
synced 2025-05-23 23:06:06 +08:00
修复查看脚本页搜索
This commit is contained in:
parent
164126ddc7
commit
325b423c4d
|
@ -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 };
|
||||
}
|
||||
}
|
||||
});
|
||||
return { tree, expandedKeys };
|
||||
}
|
||||
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);
|
||||
|
|
Loading…
Reference in New Issue
Block a user