@@ -6,6 +6,7 @@ import useMenuStore from '@/store/modules/menu'
66import useRouteStore from ' @/store/modules/route'
77import useSettingsStore from ' @/store/modules/settings'
88import { resolveRoutePath } from ' @/utils'
9+ import { useFocus } from ' @vueuse/core'
910import hotkeys from ' hotkeys-js'
1011
1112defineOptions ({
@@ -29,6 +30,8 @@ interface listTypes {
2930}
3031
3132const searchInput = ref (' ' )
33+ const searchInputRef = useTemplateRef (' searchInputRef' )
34+ const { focused : searchInputFocused } = useFocus (searchInputRef )
3235const sourceList = ref <listTypes []>([])
3336const actived = ref (- 1 )
3437
@@ -197,13 +200,13 @@ function pageJump(path: listTypes['path'], link: listTypes['link']) {
197200 </script >
198201
199202<template >
200- <FaModal ref =" searchResultRef" v-model =" isShow" border :footer =" settingsStore.mode === 'pc'" :closable =" false" class =" w-full lg-max-w-2xl" content-class =" flex flex-col p-0 min-h-auto" header-class =" p-0" footer-class =" p-0" >
203+ <FaModal ref =" searchResultRef" v-model =" isShow" border :footer =" settingsStore.mode === 'pc'" :closable =" false" class =" w-full lg-max-w-2xl" content-class =" flex flex-col p-0 min-h-auto" header-class =" p-0" footer-class =" p-0" @opened = " searchInputFocused = true " >
201204 <template #header >
202205 <div class =" h-12 flex flex-shrink-0 items-center" >
203206 <div class =" h-full w-14 flex-center" >
204207 <FaIcon name =" i-ri:search-line" class =" size-4 text-foreground/30" />
205208 </div >
206- <input v-model =" searchInput" placeholder =" 搜索页面,支持标题、URL模糊查询" class =" h-full w-full border-0 rounded-md bg-transparent text-base text-foreground focus-outline-none placeholder-foreground/30" @keydown.esc =" isShow = false" @keydown.up.prevent =" keyUp" @keydown.down.prevent =" keyDown" @keydown.enter.prevent =" keyEnter" >
209+ <input ref = " searchInputRef " v-model =" searchInput" placeholder =" 搜索页面,支持标题、URL模糊查询" class =" h-full w-full border-0 rounded-md bg-transparent text-base text-foreground focus-outline-none placeholder-foreground/30" @keydown.esc.prevent =" isShow = false" @keydown.up.prevent =" keyUp" @keydown.down.prevent =" keyDown" @keydown.enter.prevent =" keyEnter" >
207210 <div v-if =" settingsStore.mode === 'mobile'" class =" h-full w-14 flex-center border-s" >
208211 <FaIcon name =" i-carbon:close" class =" size-4" @click =" isShow = false" />
209212 </div >
0 commit comments