Skip to content

Commit 598e59f

Browse files
committed
pref: pref
1 parent 0f210df commit 598e59f

File tree

10 files changed

+1220
-711
lines changed

10 files changed

+1220
-711
lines changed

src/app-hooks/useMenuSearch.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ export interface MenuItem {
1717
// 递归扁平化菜单,并为每项生成拼音
1818
function flattenMenu(menu: MenuItem[], parentKeys: string[] = []): MenuItem[] {
1919
return menu.flatMap((item) => {
20-
const pinyinLabel = pinyin(item.label, { toneType: 'none', type: 'array' }).join(' ')
20+
const pinyinLabel = pinyin(item.label, { toneType: 'none', type: 'array' }).join(' ').toLowerCase()
2121
const flatItem = {
2222
...item,
2323
parentKeys,
@@ -35,6 +35,8 @@ function flattenMenu(menu: MenuItem[], parentKeys: string[] = []): MenuItem[] {
3535
const menuList = flattenMenu(mainLayoutMenu)
3636

3737
const fuse = new Fuse(menuList, {
38+
// Ensure English (and pinyin strings) match case-insensitively.
39+
isCaseSensitive: false,
3840
keys: [
3941
{ name: 'label', weight: 0.7 },
4042
{ name: 'pinyin', weight: 0.6 },

0 commit comments

Comments
 (0)