mirror of
https://github.com/whyour/qinglong.git
synced 2025-07-27 14:46:06 +08:00
移除注释,优化代码
This commit is contained in:
parent
0c5136539d
commit
2bd9b82cc7
|
@ -18,10 +18,6 @@
|
|||
}
|
||||
&-search {
|
||||
margin-bottom: 16px;
|
||||
// position: absolute;
|
||||
// top: 0;
|
||||
// left: 0;
|
||||
// padding-bottom: 16px;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -10,10 +10,10 @@ function getFilterData(keyword: string, data: any) {
|
|||
const expandedKeys: string[] = [];
|
||||
if (keyword) {
|
||||
const tree: any = [];
|
||||
data.forEach((item) => {
|
||||
data.forEach((item: any) => {
|
||||
if (item.title.includes(keyword)) {
|
||||
tree.push(item);
|
||||
expandedKeys.push(...item.children.map((x) => x.key));
|
||||
expandedKeys.push(...item.children.map((x: any) => x.key));
|
||||
} else {
|
||||
const children: any[] = [];
|
||||
(item.children || []).forEach((subItem: any) => {
|
||||
|
@ -95,7 +95,7 @@ const Log = () => {
|
|||
const onSearch = useCallback(
|
||||
(e) => {
|
||||
const keyword = e.target.value;
|
||||
const { tree, expandedKeys } = getFilterData(keyword, data);
|
||||
const { tree } = getFilterData(keyword, data);
|
||||
setFilterData(tree);
|
||||
},
|
||||
[data, setFilterData],
|
||||
|
|
Loading…
Reference in New Issue
Block a user