点击获取鼠标坐标 getMouseXY(e){ this.x = e.x //获取鼠标的X坐标(鼠标与屏幕左侧的距离,单位为px) this.y = e.y //获取鼠标的Y坐标(鼠标与屏幕顶部的距离,单位为px) },..._基于vue3.2 如何获取鼠标的坐标">
赞
踩
<button @click="getMouseXY($event)">点击获取鼠标坐标</button>
- getMouseXY(e){
- this.x = e.x //获取鼠标的X坐标(鼠标与屏幕左侧的距离,单位为px)
- this.y = e.y //获取鼠标的Y坐标(鼠标与屏幕顶部的距离,单位为px)
- },
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。