const { app, BrowserWindow, screen } = require('electron') const createWindow = () => { const displays = screen.getAllDisplays() const externalDisplay = displays.find((display) => { return display.bounds.x !== 0 || display.bounds.y !== 0 }) // const mainWindow = new BrowserWindow({ // width: 800, // height: 600, // x: externalDisplay.bounds.x, // y: externalDisplay.bounds.y // }) // mainWindow.loadURL('https://example.com') const win = new BrowserWindow({ frame: false, //隐藏头部操作栏 fullscreen: true, //是否全屏 x: externalDisplay.bounds.x + 50, y: externalDisplay.bounds.y + 50 // icon: path.join(__dirname, '/bb.png'), //这里指定图标 }) win.loadURL('http://127.0.0.1:9000') } app.whenReady().then(() => { createWindow() app.on('activate', () => { if (BrowserWindow.getAllWindows().length === 0) { createWindow() } }) }) app.on('window-all-closed', () => { if (process.platform !== 'darwin') { app.quit() } })