mirror of
https://github.com/whyour/qinglong.git
synced 2025-05-24 15:43:24 +08:00
日志搜索忽略大小写
This commit is contained in:
parent
b6042c7e46
commit
8df18342c0
|
@ -11,13 +11,13 @@ function getFilterData(keyword: string, data: any) {
|
||||||
if (keyword) {
|
if (keyword) {
|
||||||
const tree: any = [];
|
const tree: any = [];
|
||||||
data.forEach((item: any) => {
|
data.forEach((item: any) => {
|
||||||
if (item.title.includes(keyword)) {
|
if (item.title.toLocaleLowerCase().includes(keyword)) {
|
||||||
tree.push(item);
|
tree.push(item);
|
||||||
expandedKeys.push(...item.children.map((x: any) => 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) => {
|
||||||
if (subItem.title.includes(keyword)) {
|
if (subItem.title.toLocaleLowerCase().includes(keyword)) {
|
||||||
children.push(subItem);
|
children.push(subItem);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
@ -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 } = getFilterData(keyword, data);
|
const { tree } = getFilterData(keyword.toLocaleLowerCase(), data);
|
||||||
setFilterData(tree);
|
setFilterData(tree);
|
||||||
},
|
},
|
||||||
[data, setFilterData],
|
[data, setFilterData],
|
||||||
|
|
Loading…
Reference in New Issue
Block a user