vue 点击获取鼠标坐标(鼠标位置)
<button @click="getMouseXY($event)">点击获取鼠标坐标</button>getMouseXY(e){this.x = e.x //获取鼠标的X坐标(鼠标与屏幕左侧的距离,单位为px)this.y = e.y //获取鼠标的Y坐标(鼠标与屏幕顶部的距离,单位为px)},...
·
<button @click="getMouseXY($event)">点击获取鼠标坐标</button>
getMouseXY(e){
this.x = e.x //获取鼠标的X坐标(鼠标与屏幕左侧的距离,单位为px)
this.y = e.y //获取鼠标的Y坐标(鼠标与屏幕顶部的距离,单位为px)
},
更多推荐
已为社区贡献27条内容
所有评论(0)