From e7c17cf531cd2424e0dedd996b83b0fddb01bf6a Mon Sep 17 00:00:00 2001 From: imsyy Date: Fri, 26 Apr 2024 10:02:25 +0800 Subject: [PATCH] =?UTF-8?q?=F0=9F=90=9E=20fix:=20=E4=BF=AE=E5=A4=8D?= =?UTF-8?q?=E5=81=B6=E5=8F=91=E6=80=A7=E5=AE=A2=E6=88=B7=E7=AB=AF=E7=8A=B6?= =?UTF-8?q?=E6=80=81=E6=A0=8F=E5=BC=82=E5=B8=B8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/Nav/MainNav.vue | 5 +---- src/utils/helper.js | 7 ++++++- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/src/components/Nav/MainNav.vue b/src/components/Nav/MainNav.vue index 0d0e29e1..328c3dc4 100644 --- a/src/components/Nav/MainNav.vue +++ b/src/components/Nav/MainNav.vue @@ -93,7 +93,7 @@ - + @@ -122,9 +122,6 @@ const openGithub = () => { window.open(packageJson.github); }; -// 是否显示 TitleBar -const showTitleBar = computed(() => checkPlatform.electron()); - // 主菜单渲染 const mainMenuShow = ref(false); const mainMenuOptions = computed(() => [ diff --git a/src/utils/helper.js b/src/utils/helper.js index 89f07135..7f1d3bed 100644 --- a/src/utils/helper.js +++ b/src/utils/helper.js @@ -8,7 +8,12 @@ let lastDownloadBlobUrl = null; */ export const checkPlatform = { electron: () => { - return typeof electron !== "undefined"; + // return typeof electron !== "undefined"; + if (typeof process !== "undefined" && process.versions) { + return process.versions.electron ? true : false; + } + const userAgent = navigator.userAgent.toLowerCase(); + return userAgent.includes("electron"); }, macOS: () => { if (!checkPlatform.electron()) return false;