electron如何获取鼠标的横坐标和纵坐标

electron中要获取鼠标的横坐标和纵坐标,需要先引入screen模块
例子如下:

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

const {x,y} = screen.getCursorScreenPoint();//获取到鼠标的横坐标和纵坐标
console.log(x,y);

发表评论

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