vue獲取url地址 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)單擊時(shí)觸發(fā),類似單擊事件
touchstart(E){
]控制臺.log(“touchstart”)
},
//鼠標(biāo)移動(dòng)時(shí)觸發(fā)
touchmove(E){控制臺.log(“touchmove”)
}
在事件回調(diào)中使用e.targettouches屬性。
//獲取x坐標(biāo)
e.targettouches[0]。Clientx
//獲取y坐標(biāo)
e.targettouches[0]。客戶路線。匹配
我不能獲取當(dāng)前路線位置.href
方法是使用Vue資源組件提供的一系列API:get(URL,[data],[success],[options])post(URL,[data],[success],[options])put(URL,[data],[success],[options])patch(URL,[data],[success],[options])delete(URL,[data]、[success]、[options])JSON(URL、[data]、[success]、[options])具體示例如下:1。導(dǎo)入vue-resource2。基于所有Vue對象使用HTTP//通過someurl獲取后臺數(shù)據(jù),成功后執(zhí)行代碼Vue.http.get獲取(“/someurl”,[選項(xiàng)])。然后(successcallback,errorcallback)3。在Vue實(shí)例中使用$http//$http是Vue$local范圍內(nèi)的一個(gè)實(shí)例http.get獲取(“/someUrl”,[options])。then(successCallback,then方法有兩個(gè)參數(shù)。第一個(gè)參數(shù)是響應(yīng)成功時(shí)的回調(diào)函數(shù),第二個(gè)參數(shù)是響應(yīng)失敗時(shí)的回調(diào)函數(shù)。
vue怎么在根組件里取到當(dāng)前使用的路由呢?
在數(shù)據(jù)中添加一個(gè)now in,然后為每個(gè)Li添加一個(gè)click事件。點(diǎn)擊后,將當(dāng)前Li數(shù)據(jù)放入now