话不多说直接上代码
const {app,BrowserWindow,} = require('electron')
let mainWindow
function createWindow() {
mainWindow = new BrowserWindow({
webPreferences: {
webSecurity: false
}
})
mainWindow.loadFile('index.html')
//重点在下面这行,开启调试
mainWindow.webContents.openDevTools()
mainWindow.on('closed', function () {
mainWindow = null
})
}
//其余的配置就不贴了