electron如何获取屏幕的宽度和高度

electron中要获取到屏幕尺寸,需要引入screen模块
例子如下:

const remote = require('electron').remote;
const screen = remote.screen;

const {width,height} = screen.getPrimaryDisplay().workAreaSize;//获取到屏幕的宽度和高度
console.log(width,height);

发表评论

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen: