Merge pull request #288 from jaw52/fix/open_child_window

Fix/open child window
This commit is contained in:
草鞋没号 2022-10-21 17:17:25 +08:00 committed by GitHub
commit dfa7f855f9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 6 additions and 1 deletions

3
.gitignore vendored
View File

@ -23,4 +23,7 @@ dist-ssr
release release
.vscode/.debug.env .vscode/.debug.env
package-lock.json
pnpm-lock.yaml
yarn.lock
dist-electron dist-electron

View File

@ -101,13 +101,15 @@ ipcMain.handle('open-win', (event, arg) => {
const childWindow = new BrowserWindow({ const childWindow = new BrowserWindow({
webPreferences: { webPreferences: {
preload, preload,
nodeIntegration: true,
contextIsolation: false,
}, },
}) })
if (app.isPackaged) { if (app.isPackaged) {
childWindow.loadFile(indexHtml, { hash: arg }) childWindow.loadFile(indexHtml, { hash: arg })
} else { } else {
childWindow.loadURL(`${url}/#${arg}`) childWindow.loadURL(`${url}#${arg}`)
// childWindow.webContents.openDevTools({ mode: "undocked", activate: true }) // childWindow.webContents.openDevTools({ mode: "undocked", activate: true })
} }
}) })