发布时间: 2019-10-29 09:06:00
https://stackoverflow.com/questions/45553162/how-to-get-mouse-coordinates-in-vuejs
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); } }Back