electron-vue
electron-vue copied to clipboard
创建一个子窗口,devtools报错。。不能使用多个窗口嘛?
Found an issue or bug with electron-vue? Tell me all about it!
Questions regarding how to use electron or vue are likely to be closed as they are not direct issues with this boilerplate. Please seek solutions from official documentation or their respective communities.
Describe the issue / bug.
# main/index,js 代码如下 import { app, BrowserWindow, ipcMain } from 'electron'
/**
- Set
__staticpath to static files in production - https://simulatedgreg.gitbooks.io/electron-vue/content/en/using-static-assets.html */ if (process.env.NODE_ENV !== 'development') { global.__static = require('path').join(__dirname, '/static').replace(/\/g, '\\') }
let mainWindow
const winURL = process.env.NODE_ENV === 'development' ?
http://localhost:9080 :
file://${__dirname}/index.html
function createWindow() { /**
- Initial window options */ mainWindow = new BrowserWindow({ height: 563, useContentSize: true, width: 1000, webPreferences: { webSecurity: false, // 是否禁用浏览器的跨域安全特性 nodeIntegration: true // 是否完整支持node } })
mainWindow.loadURL(winURL)
mainWindow.on('closed', () => { mainWindow = null }) }
// 开启screen-main新窗口 function openScreen() { var screenWin = new BrowserWindow({ width: 1000, height: 550, useContentSize: true, // parent: mainWindow, webPreferences: { webSecurity: false, // 是否禁用浏览器的跨域安全特性 nodeIntegration: true // 是否完整支持node } }) screenWin.loadURL(mainWindow + '#/screen'); screenWin.on('closed', () => { screenWin = null }) }
ipcMain.on('openScreen', e => { // mainWindow.hide(); openScreen() }
);
app.on('ready', createWindow)
app.on('window-all-closed', () => { if (process.platform !== 'darwin') { app.quit() } })
app.on('activate', () => { if (mainWindow === null) { createWindow() } })
/**
- Auto Updater
- Uncomment the following code below and install
electron-updaterto - support auto updating. Code Signing with a valid certificate is required.
- https://simulatedgreg.gitbooks.io/electron-vue/content/en/using-electron-builder.html#auto-updating */
/* import { autoUpdater } from 'electron-updater'
autoUpdater.on('update-downloaded', () => { autoUpdater.quitAndInstall() })
app.on('ready', () => { if (process.env.NODE_ENV === 'production') autoUpdater.checkForUpdates() }) */
How can I reproduce this problem?

#
If visual, provide a screenshot.
#
Tell me about your development environment.
- Node version:
- NPM version:
- vue-cli version: (if necessary)
- Operating System:
If you are looking to suggest an enhancement or feature, then feel free to remove everything above.
你可以尝试 https://github.com/ci010/electron-vue-next, 是基于 vite 和 vue 3,支持多窗口