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 {
|
&-search {
|
||||||
margin-bottom: 16px;
|
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[] = [];
|
const expandedKeys: string[] = [];
|
||||||
if (keyword) {
|
if (keyword) {
|
||||||
const tree: any = [];
|
const tree: any = [];
|
||||||
data.forEach((item) => {
|
data.forEach((item: any) => {
|
||||||
if (item.title.includes(keyword)) {
|
if (item.title.includes(keyword)) {
|
||||||
tree.push(item);
|
tree.push(item);
|
||||||
expandedKeys.push(...item.children.map((x) => x.key));
|
expandedKeys.push(...item.children.map((x: any) => x.key));
|
||||||
} else {
|
} else {
|
||||||
const children: any[] = [];
|
const children: any[] = [];
|
||||||
(item.children || []).forEach((subItem: any) => {
|
(item.children || []).forEach((subItem: any) => {
|
||||||
|
@ -95,7 +95,7 @@ const Log = () => {
|
||||||
const onSearch = useCallback(
|
const onSearch = useCallback(
|
||||||
(e) => {
|
(e) => {
|
||||||
const keyword = e.target.value;
|
const keyword = e.target.value;
|
||||||
const { tree, expandedKeys } = getFilterData(keyword, data);
|
const { tree } = getFilterData(keyword, data);
|
||||||
setFilterData(tree);
|
setFilterData(tree);
|
||||||
},
|
},
|
||||||
[data, setFilterData],
|
[data, setFilterData],
|
||||||
|
|
Loading…
Reference in New Issue
Block a user