Vue 右鍵菜單 vue elementui如何獲取當(dāng)前鼠標(biāo)的位置?
vue elementui如何獲取當(dāng)前鼠標(biāo)的位置?代碼示例:<div id=“app”><div class=“circle”@touchstart=“touchstart”@touchm
vue elementui如何獲取當(dāng)前鼠標(biāo)的位置?
代碼示例:<div id=“app”>
<div class=“circle”@touchstart=“touchstart”@touchmove=“touchmove”></div>
</div>
讓app=New Vue({
El:“app”,
data:{
message:“app”]},
方法:{
//鼠標(biāo)單擊時觸發(fā),類似單擊事件
touchstart(E){
]控制臺.log(“touchstart”)
},
//鼠標(biāo)移動時觸發(fā)
touchmove(E){控制臺.log(“touchmove”)
}
在事件回調(diào)中使用e.targettouches屬性。
//獲取x坐標(biāo)
e.targettouches[0]。Clientx
//獲取y坐標(biāo)
e.targettouches[0]。客戶