移除注释,优化代码

This commit is contained in:
周腾 2021-06-04 20:57:35 +08:00
parent 0c5136539d
commit 2bd9b82cc7
2 changed files with 3 additions and 7 deletions

View File

@ -18,10 +18,6 @@
}
&-search {
margin-bottom: 16px;
// position: absolute;
// top: 0;
// left: 0;
// padding-bottom: 16px;
}
}

View File

@ -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],