From b6ed4a3f695f810fd29f141c2901e3622a490d70 Mon Sep 17 00:00:00 2001
From: Hooray <304327508@qq.com>
Date: Sat, 18 Feb 2023 22:19:39 +0800
Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96mac=E7=B3=BB=E7=BB=9F?=
=?UTF-8?q?=E4=B8=8B=E5=BF=AB=E6=8D=B7=E9=94=AE=E9=94=AE=E4=BD=8D=E5=B1=95?=
=?UTF-8?q?=E7=A4=BA?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
src/layouts/components/HotkeysIntro/index.vue | 6 +++---
src/layouts/components/Search/index.vue | 2 +-
src/store/modules/settings.ts | 16 ++++++++++++++++
3 files changed, 20 insertions(+), 4 deletions(-)
diff --git a/src/layouts/components/HotkeysIntro/index.vue b/src/layouts/components/HotkeysIntro/index.vue
index bb453f62..d131c6b5 100644
--- a/src/layouts/components/HotkeysIntro/index.vue
+++ b/src/layouts/components/HotkeysIntro/index.vue
@@ -18,15 +18,15 @@ onMounted(() => {
- Alt + I
+ {{ settingsStore.os === 'mac' ? '⌥' : 'Alt' }} + I
- Alt + S
+ {{ settingsStore.os === 'mac' ? '⌥' : 'Alt' }} + S
- Alt + `
+ {{ settingsStore.os === 'mac' ? '⌥' : 'Alt' }} + `
diff --git a/src/layouts/components/Search/index.vue b/src/layouts/components/Search/index.vue
index 4a2e8582..7e696a74 100644
--- a/src/layouts/components/Search/index.vue
+++ b/src/layouts/components/Search/index.vue
@@ -248,7 +248,7 @@ function pageJump(path: listTypes['path'], link: listTypes['link']) {
- Alt + S
+ {{ settingsStore.os === 'mac' ? '⌥' : 'Alt' }} + S
唤醒搜索面板
diff --git a/src/store/modules/settings.ts b/src/store/modules/settings.ts
index b6c8fd5e..6d27bd8f 100644
--- a/src/store/modules/settings.ts
+++ b/src/store/modules/settings.ts
@@ -31,6 +31,21 @@ const useSettingsStore = defineStore(
immediate: true,
})
+ // 操作系统
+ const os = ref<'mac' | 'windows' | 'linux' | 'other'>('other')
+ const agent = navigator.userAgent.toLowerCase()
+ switch (true) {
+ case agent.includes('mac os'):
+ os.value = 'mac'
+ break
+ case agent.includes('windows'):
+ os.value = 'windows'
+ break
+ case agent.includes('linux'):
+ os.value = 'linux'
+ break
+ }
+
// 页面标题
const title = ref()
// 设置网页标题
@@ -92,6 +107,7 @@ const useSettingsStore = defineStore(
return {
settings,
+ os,
title,
setTitle,
mode,