fix: 修复部分页面出现空白的情况

This commit is contained in:
kuaifan 2025-04-07 20:09:45 +08:00
parent d1702bd62c
commit 83d3b3ffbf
2 changed files with 5 additions and 2 deletions

View File

@ -439,7 +439,7 @@ function createChildWindow(args) {
electronMenu.webContentsMenu(browser.webContents) electronMenu.webContentsMenu(browser.webContents)
// 加载地址 // 加载地址
const hash = args.hash || args.path; const hash = `${args.hash || args.path}`;
if (/^https?:/i.test(hash)) { if (/^https?:/i.test(hash)) {
browser.loadURL(hash).then(_ => { }).catch(_ => { }) browser.loadURL(hash).then(_ => { }).catch(_ => { })
} else if (isPreload) { } else if (isPreload) {

View File

@ -341,7 +341,7 @@ const $preload = async () => {
} }
await store.dispatch("preload"); 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') { if (hash !== 'preload') {
await $init() await $init()
return return
@ -355,6 +355,9 @@ const $preload = async () => {
} }
route = route.replace(/^https?:\/\/[^\/]+/, ''); route = route.replace(/^https?:\/\/[^\/]+/, '');
} }
if (routeMode === 'hash') {
route = `#/${route.replace(/^[#\/\s]+/, '')}`;
}
window.history.replaceState(null, '', route) window.history.replaceState(null, '', route)
await $init() await $init()
} }