diff --git a/src/components/DialogExplorer.vue b/src/components/DialogExplorer.vue index 810c817..5e92ca5 100644 --- a/src/components/DialogExplorer.vue +++ b/src/components/DialogExplorer.vue @@ -184,7 +184,8 @@ const currentDataList = computed(() => { renderedList = found?.children || [] } - if (searchContent.value) { + const filter = searchContent.value?.toLowerCase().trim() ?? '' + if (filter) { const filterItems: ModelTreeNode[] = [] const searchList = [...renderedList] @@ -194,11 +195,10 @@ const currentDataList = computed(() => { const children = (item as any).children ?? [] searchList.push(...children) - if ( - item.basename - .toLocaleLowerCase() - .includes(searchContent.value.toLocaleLowerCase()) - ) { + const matchSubFolder = `${item.subFolder}/`.toLowerCase().includes(filter) + const matchName = item.basename.toLowerCase().includes(filter) + + if (matchSubFolder || matchName) { filterItems.push(item) } } diff --git a/src/components/DialogManager.vue b/src/components/DialogManager.vue index e0942ba..094c06b 100644 --- a/src/components/DialogManager.vue +++ b/src/components/DialogManager.vue @@ -223,11 +223,12 @@ const list = computed(() => { const showAllModel = currentType.value === allType const matchType = showAllModel || model.type === currentType.value - const matchName = model.basename - .toLowerCase() - .includes(searchContent.value?.toLowerCase() || '') - return matchType && matchName + const filter = searchContent.value?.toLowerCase() ?? '' + const matchSubFolder = model.subFolder.toLowerCase().includes(filter) + const matchName = model.basename.toLowerCase().includes(filter) + + return matchType && (matchSubFolder || matchName) }) let sortStrategy: (a: Model, b: Model) => number = () => 0