diff --git a/src/layout/header/search/index.tsx b/src/layout/header/search/index.tsx
index 309d291..32b541f 100644
--- a/src/layout/header/search/index.tsx
+++ b/src/layout/header/search/index.tsx
@@ -8,68 +8,73 @@ import SearchSuggestion from './SearchSuggestion'
import useLayoutStore from '@/layout/useLayoutStore'
import clsx from 'clsx'
-export default defineComponent((props: {
- isMini?: boolean
-}) => {
- const settings = useSettingsStore()
- const search = useSearchStore()
- const searchConfig = useSearchConfigStore()
- const layout = useLayoutStore()
- return () => (
-
+export default defineComponent(
+ (props: { isMini?: boolean }) => {
+ const settings = useSettingsStore()
+ const search = useSearchStore()
+ const searchConfig = useSearchConfigStore()
+ const layout = useLayoutStore()
+ return () => (
{
- search.showSearchConfig = true
+ class={clsx(
+ 'w-full h-11 shadow-content overflow-hidden px-1 transition-all flex justify-between items-center gap-4 ',
+ search.focus ? 'bg-white/60' : 'bg-white/40 hover:bg-white/60',
+ props.isMini ? '' : 'max-w-[90vw] w-full'
+ )}
+ style={{
+ borderRadius: settings.state.searchRadius + 'px'
}}
>
{
+ search.showSearchConfig = true
}}
+ >
+
+
+
(search.searchRef = el as any)}
+ onContextmenu={(e) => e.stopPropagation()}
+ onKeydown={(e) => e.stopPropagation()}
+ class="flex-1 h-full outline-none bg-transparent placeholder:text-slate-600 placeholder:tracking-widest text-slate-800 pr-4"
+ placeholder={`输入搜索 ${searchConfig.current.name}`}
/>
-
(search.searchRef = el as any)}
- onContextmenu={(e) => e.stopPropagation()}
- class="flex-1 h-full outline-none bg-transparent placeholder:text-slate-600 placeholder:tracking-widest text-slate-800 pr-4"
- placeholder={`输入搜索 ${searchConfig.current.name}`}
- />
+
{search.showSearchConfig && }
+
+ {search.focus && !search.searchStr && searchConfig.history.length > 0 && (
+
+ )}
+
+
+ {search.focus && search.searchStr && }
+
-
{search.showSearchConfig && }
-
- {search.focus && !search.searchStr && searchConfig.history.length > 0 && }
-
-
- {search.focus && search.searchStr && }
-
-
- )
-}, {
- name: 'SearchComponent',
- props: ['isMini']
-})
+ )
+ },
+ {
+ name: 'SearchComponent',
+ props: ['isMini']
+ }
+)
diff --git a/src/layout/useLayoutStore.ts b/src/layout/useLayoutStore.ts
index 5341442..3109a6e 100644
--- a/src/layout/useLayoutStore.ts
+++ b/src/layout/useLayoutStore.ts
@@ -4,6 +4,8 @@ import { computed, reactive, ref, toRaw, watch } from 'vue'
import db from '@/db'
import useResource from './background/useResource'
import { globalToast } from '@/main'
+import jump from '@/utils/jump'
+import useSettingsStore from '@/settings/useSettingsStore'
const defaultLayout: Layout = {
content: [
@@ -20,6 +22,7 @@ const defaultLayout: Layout = {
}
export default defineStore('layout', () => {
+ const settings = useSettingsStore()
const state = reactive(defaultLayout)
const ready = ref(false)
@@ -86,6 +89,12 @@ export default defineStore('layout', () => {
if (openDir.value === id) {
openDir.value = ''
}
+ } else if (dir && dir.list.length === 0) {
+ const idx = currentPage.value.list.findIndex((el) => el.link === 'id:' + id)
+ if (idx < 0) return
+ currentPage.value.list.splice(idx, 1)
+ delete state.dir[id]
+ openDir.value = ''
}
}
@@ -96,7 +105,6 @@ export default defineStore('layout', () => {
}
// 处理不同的组件的名称
if (block.name === 'gameVideo') {
-
return state.current === 0 ? '游戏视频' : state.current === 1 ? '学习视频' : '娱乐视频'
}
return block.label || ''
@@ -105,6 +113,18 @@ export default defineStore('layout', () => {
const changeBackground = (url: string) => {
state.content[state.current].background = url
}
+ document.addEventListener('keydown', (e) => {
+ if (settings.state.disabledShortcut) return
+ const arr = state.dockLabels.split('')
+ for (const key in arr) {
+ if (arr[key] === e.key.toLocaleUpperCase()) {
+ const block = state.dock[key]
+ if (block) {
+ jump(block.link)
+ }
+ }
+ }
+ })
return {
state,
ready,
diff --git a/src/settings/useSettingsStore.ts b/src/settings/useSettingsStore.ts
index e9375c1..ab8f34f 100644
--- a/src/settings/useSettingsStore.ts
+++ b/src/settings/useSettingsStore.ts
@@ -2,7 +2,7 @@ import { defineStore } from 'pinia'
import { computed, reactive } from 'vue'
export type VisibleState = 'show' | 'auto' | ''
-export type TimeUnit = 'date' | 'week' | '12hour' | 'lunal' | 'second';
+export type TimeUnit = 'date' | 'week' | '12hour' | 'lunal' | 'second'
export default defineStore(
'settings',
() => {
@@ -31,7 +31,8 @@ export default defineStore(
searchOpacity: 0.75,
// 侧边栏
siderDirection: 'left' as 'left' | 'right',
-
+ // 禁用快捷键
+ disabledShortcut: false
})
return { state, blockInner: computed(() => state.blockSize - 2 * state.blockPadding) }
},