js - 获得鼠标当前的位置
访问量: 1675
methods: {
someMethod(event) {
// clientX/Y gives the coordinates relative to the viewport in CSS pixels.
console.log(event.clientX); // x coordinate
console.log(event.clientY); // y coordinate
// pageX/Y gives the coordinates relative to the element in CSS pixels.
console.log(event.pageX);
console.log(event.pagey);
// screenX/Y gives the coordinates relative to the screen in device pixels.
console.log(event.screenX);
console.log(event.screenY);
}
}