From 83d3b3ffbf8003fab8d4c01405a36488fae88681 Mon Sep 17 00:00:00 2001 From: kuaifan Date: Mon, 7 Apr 2025 20:09:45 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E4=BF=AE=E5=A4=8D=E9=83=A8=E5=88=86?= =?UTF-8?q?=E9=A1=B5=E9=9D=A2=E5=87=BA=E7=8E=B0=E7=A9=BA=E7=99=BD=E7=9A=84?= =?UTF-8?q?=E6=83=85=E5=86=B5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- electron/electron.js | 2 +- resources/assets/js/app.js | 5 ++++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/electron/electron.js b/electron/electron.js index 55793805d..5864d46b4 100644 --- a/electron/electron.js +++ b/electron/electron.js @@ -439,7 +439,7 @@ function createChildWindow(args) { electronMenu.webContentsMenu(browser.webContents) // 加载地址 - const hash = args.hash || args.path; + const hash = `${args.hash || args.path}`; if (/^https?:/i.test(hash)) { browser.loadURL(hash).then(_ => { }).catch(_ => { }) } else if (isPreload) { diff --git a/resources/assets/js/app.js b/resources/assets/js/app.js index 0955eaa94..11777be01 100644 --- a/resources/assets/js/app.js +++ b/resources/assets/js/app.js @@ -341,7 +341,7 @@ const $preload = async () => { } await store.dispatch("preload"); - const hash = (window.location[routeMode === 'history' ? 'pathname' : 'hash']).replace(/^[#\/\s]/, ''); + const hash = (window.location[routeMode === 'history' ? 'pathname' : 'hash']).replace(/^[#\/\s]+/, ''); if (hash !== 'preload') { await $init() return @@ -355,6 +355,9 @@ const $preload = async () => { } route = route.replace(/^https?:\/\/[^\/]+/, ''); } + if (routeMode === 'hash') { + route = `#/${route.replace(/^[#\/\s]+/, '')}`; + } window.history.replaceState(null, '', route) await $init() }