소스 검색

feat: 过滤增加大小写忽略问题

xyh 2 년 전
부모
커밋
4f31e2c76b
1개의 변경된 파일6개의 추가작업 그리고 3개의 파일을 삭제
  1. 6 3
      packages/app/src/hooks/use-select-filter-options/index.tsx

+ 6 - 3
packages/app/src/hooks/use-select-filter-options/index.tsx

@@ -18,9 +18,12 @@ export function useSelectFilterOptions<
     function () {
       if (!search) return options;
 
-      return options.filter(
-        ({label, value}) => label?.includes(search) || value?.includes(search),
-      );
+      return options.filter(function ({label, value}) {
+        return (
+          label?.toLowerCase()?.includes(search.toLowerCase()) ||
+          value?.toLowerCase()?.includes(search.toLowerCase())
+        );
+      });
     },
     [options, search],
   );