fix(editor): 优化组件列表与图层面板搜索过滤

支持大小写不敏感匹配,组件列表扩展 desc、type 字段搜索。
This commit is contained in:
roymondchen 2026-08-04 19:13:33 +08:00
parent 6f0a41f2db
commit 7777c205b9
2 changed files with 6 additions and 2 deletions

View File

@ -71,7 +71,11 @@ const stage = computed(() => editorService.get('stage'));
const list = computed<ComponentGroup[]>(() =>
componentListService.getList().map((group: ComponentGroup) => ({
...group,
items: group.items.filter((item: ComponentItem) => item.text.includes(searchText.value)),
items: group.items.filter((item: ComponentItem) =>
`${item.text || ''}${item.desc || ''}${item.type}`
.toLocaleLowerCase()
.includes(searchText.value.toLocaleLowerCase()),
),
})),
);

View File

@ -120,7 +120,7 @@ const filterNodeMethod = (v: string, data: MNode): boolean => {
name = 'container';
}
return `${data.id}${name}${data.type}`.includes(v);
return `${data.id}${name}${data.type || ''}`.toLocaleLowerCase().includes(v.toLocaleLowerCase());
};
const { filterTextChangeHandler } = useFilter(nodeData, nodeStatusMap, filterNodeMethod);