mirror of
https://github.com/electron-vite/electron-vite-vue
synced 2025-01-19 03:46:35 +08:00
feature: 在应用未打包时自动打开 devTools
This commit is contained in:
parent
858ea14cfa
commit
aec9a41f66
@ -2,6 +2,8 @@ import { app, BrowserWindow, shell, ipcMain } from 'electron'
|
||||
import { release } from 'os'
|
||||
import { join } from 'path'
|
||||
|
||||
const { isPackaged } = app
|
||||
|
||||
// Disable GPU Acceleration for Windows 7
|
||||
if (release().startsWith('6.1')) app.disableHardwareAcceleration()
|
||||
|
||||
@ -46,13 +48,16 @@ async function createWindow() {
|
||||
},
|
||||
})
|
||||
|
||||
if (app.isPackaged) {
|
||||
if (isPackaged) {
|
||||
win.loadFile(indexHtml)
|
||||
} else {
|
||||
win.loadURL(url)
|
||||
// win.webContents.openDevTools()
|
||||
}
|
||||
|
||||
// Open devTool if the app is not packaged
|
||||
!isPackaged && win.webContents.openDevTools()
|
||||
|
||||
// Test actively push message to the Electron-Renderer
|
||||
win.webContents.on('did-finish-load', () => {
|
||||
win?.webContents.send('main-process-message', new Date().toLocaleString())
|
||||
|
Loading…
x
Reference in New Issue
Block a user