获取屏幕
注意需要在 new 之后获取
import { BrowserWindow, screen } from'electron';
const win = new BrowserWindow({
width: screen.getPrimaryDisplay().workAreaSize.width,
height: screen.getPrimaryDisplay().workAreaSize.height,
webPreferences: {
nodeIntegration: true
}
});
const {BrowserWindow, screen} = require('electron');
let window = new BrowserWindow();
// Load a URL and show the window first
const winBounds = window.getBounds();
const whichScreen = screen.getDisplayNearestPoint({x: winBounds.x, y: winBounds.y});
// Returns the screen where your window is located