Browse Source

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

xyh 2 years ago
parent
commit
4f31e2c76b
1 changed files with 6 additions and 3 deletions
  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],
   );