From 2292952d0396858e3ad441216c8fb1a47c6d69a6 Mon Sep 17 00:00:00 2001
From: Hooray <304327508@qq.com>
Date: Wed, 26 Feb 2025 17:42:01 +0800
Subject: [PATCH] =?UTF-8?q?=E5=BF=AB=E6=8D=B7=E9=94=AE=E4=BA=8B=E4=BB=B6?=
=?UTF-8?q?=E7=BB=91=E5=AE=9A/=E8=A7=A3=E7=BB=91=E8=BF=81=E7=A7=BB?=
=?UTF-8?q?=E5=88=B0=E5=90=84=E8=87=AA=E7=BB=84=E4=BB=B6=E4=B8=AD?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
src/layouts/components/HotkeysIntro/index.vue | 8 +++++++
src/layouts/components/MainSidebar/index.vue | 20 ++++++++++++++++
.../Topbar/Toolbar/PageReload/index.vue | 13 +++++++++++
src/layouts/index.vue | 23 -------------------
4 files changed, 41 insertions(+), 23 deletions(-)
diff --git a/src/layouts/components/HotkeysIntro/index.vue b/src/layouts/components/HotkeysIntro/index.vue
index d8a70e3a..c073e1e2 100755
--- a/src/layouts/components/HotkeysIntro/index.vue
+++ b/src/layouts/components/HotkeysIntro/index.vue
@@ -54,6 +54,14 @@ onMounted(() => {
激活下一个主导航
+
+
+ {{ settingsStore.os === 'mac' ? '⌥' : 'Alt' }}
+ {{ settingsStore.os === 'mac' ? '⇧' : 'Shift' }}
+ `
+
+ 激活上一个主导航
+
diff --git a/src/layouts/components/MainSidebar/index.vue b/src/layouts/components/MainSidebar/index.vue
index e26c8708..70308033 100755
--- a/src/layouts/components/MainSidebar/index.vue
+++ b/src/layouts/components/MainSidebar/index.vue
@@ -2,6 +2,7 @@
import { useSlots } from '@/slots'
import useMenuStore from '@/store/modules/menu'
import useSettingsStore from '@/store/modules/settings'
+import hotkeys from 'hotkeys-js'
import Logo from '../Logo/index.vue'
defineOptions({
@@ -12,6 +13,25 @@ const settingsStore = useSettingsStore()
const menuStore = useMenuStore()
const { switchTo } = useMenu()
+
+onMounted(() => {
+ hotkeys('alt+`', (e) => {
+ if (settingsStore.settings.menu.enableHotkeys && ['side', 'head'].includes(settingsStore.settings.menu.mode)) {
+ e.preventDefault()
+ switchTo(menuStore.actived + 1 < menuStore.allMenus.length ? menuStore.actived + 1 : 0)
+ }
+ })
+ hotkeys('alt+shift+`', (e) => {
+ if (settingsStore.settings.menu.enableHotkeys && ['side', 'head'].includes(settingsStore.settings.menu.mode)) {
+ e.preventDefault()
+ switchTo(menuStore.actived - 1 >= 0 ? menuStore.actived - 1 : menuStore.allMenus.length - 1)
+ }
+ })
+})
+onUnmounted(() => {
+ hotkeys.unbind('alt+`')
+ hotkeys.unbind('alt+shift+`')
+})
diff --git a/src/layouts/components/Topbar/Toolbar/PageReload/index.vue b/src/layouts/components/Topbar/Toolbar/PageReload/index.vue
index 7192af27..3f333b08 100644
--- a/src/layouts/components/Topbar/Toolbar/PageReload/index.vue
+++ b/src/layouts/components/Topbar/Toolbar/PageReload/index.vue
@@ -1,5 +1,6 @@