版本管理,优化
This commit is contained in:
@@ -42,6 +42,11 @@ const hasSearchContent = computed(() => {
|
||||
return searchQuery.value.trim().length > 0
|
||||
})
|
||||
|
||||
/** 模块 id → 名称 查找表(用于搜索结果中标注所属模块) */
|
||||
const moduleNameById = computed(() => {
|
||||
return new Map(props.modules.map(m => [m.id, m.name]))
|
||||
})
|
||||
|
||||
const handleSearchSelect = (moduleId: string) => {
|
||||
emit('search', moduleId)
|
||||
searchQuery.value = ''
|
||||
@@ -50,6 +55,10 @@ const handleSearchSelect = (moduleId: string) => {
|
||||
|
||||
const handleSettingSelect = (item: SearchItem) => {
|
||||
emit('search', item.moduleId)
|
||||
// 记录待跳转 tab:模块挂载后由 useModuleTabs 自动切换(模块已挂载时同样生效)
|
||||
if (item.tab) {
|
||||
tabsStore.setPendingTab(item.moduleId, item.tab)
|
||||
}
|
||||
if (item.action) {
|
||||
item.action()
|
||||
}
|
||||
@@ -323,14 +332,19 @@ const handleBlur = () => {
|
||||
class="w-full px-3 py-2 text-left text-sm hover:bg-accent transition-colors flex items-center gap-2"
|
||||
@click="handleSettingSelect(item)"
|
||||
>
|
||||
<Settings class="size-4 text-muted-foreground" />
|
||||
<Settings class="size-4 text-muted-foreground shrink-0" />
|
||||
<div class="flex-1 min-w-0">
|
||||
<span class="truncate">{{ item.title }}</span>
|
||||
<div class="flex items-center gap-1.5">
|
||||
<span class="truncate">{{ item.title }}</span>
|
||||
<span class="shrink-0 text-[10px] text-muted-foreground/70 px-1 py-px rounded bg-muted">
|
||||
{{ moduleNameById.get(item.moduleId) || item.moduleId }}
|
||||
</span>
|
||||
</div>
|
||||
<span v-if="item.description" class="block text-xs text-muted-foreground truncate">
|
||||
{{ item.description }}
|
||||
</span>
|
||||
</div>
|
||||
<ChevronRight class="size-4 text-muted-foreground" />
|
||||
<ChevronRight class="size-4 text-muted-foreground shrink-0" />
|
||||
</button>
|
||||
</template>
|
||||
|
||||
|
||||
Reference in New Issue
Block a user