SimulatedGREG / electron-vue

An Electron & Vue.js quick start boilerplate with vue-cli scaffolding, common Vue plugins, electron-packager/electron-builder, unit/e2e testing, vue-devtools, and webpack.
https://simulatedgreg.gitbooks.io/electron-vue/content/
MIT License
15.47k stars 1.54k forks source link

How to create new BrowserWindow? #936

Open changzi opened 4 years ago

changzi commented 4 years ago

我有一个主窗口,根据业务需要,需要新开启另外一个新窗口,但在打包后,新窗口打开空白?请问怎么解决?

jordandc1 commented 4 years ago

在主进程再打开一个窗口 let win = new BrowserWindow({ width: 1400, height: 800, resizable: false, autoHideMenuBar: true, webPreferences: { webSecurity: false } }) win.on('closed', () => { win = null })

// Or load a local HTML file const initWinURL = process.env.NODE_ENV === 'development' ? http://localhost:9080#showInit : file://${__dirname}/init.html#showInit win.loadURL(initWinURL)

ideacco commented 4 years ago

在主进程再打开一个窗口 let win = new BrowserWindow({ width: 1400, height: 800, resizable: false, autoHideMenuBar: true, webPreferences: { webSecurity: false } }) win.on('closed', () => { win = null })

// Or load a local HTML file const initWinURL = process.env.NODE_ENV === 'development' ? http://localhost:9080#showInit : file://${__dirname}/init.html#showInit win.loadURL(initWinURL)

Thank you for your reply. If this html file is built with webpack, how do I set up webpack?