标签:dde span targe off box 样式 touch eth return
1.获取元素高度
<div ref=‘box‘>元素</div>
var height=this.$ref.box.offsetHeight
2.设置样式
<div :style=‘mystyle‘></div>
data(){
return {
mystyle:‘‘
}
}
mystyle=‘color:red‘
3.vue touch事件
<div class="li" @touchstart="startEvent" @touchmove="moveEvent" @touchend="endEvent"> methods:{ startEvent(e){ var touchesstart = e.targetTouches[0]; this.start = { x: touchesstart.clientX, // 横坐标 y: touchesstart.clientY // 纵坐标 }; }, moveEvent(e){ var touchesmove = e.changedTouches[0].clientX; this.delta = { x: touchesmove.clientX - this.start.x, y: touchesmove.clientY - this.start.y }; }, endEvent(e){ var touchesend= e.changedTouches[0] this.enddelta = { x: touchesend.clientX - this.start.x, y: touchesend.clientY - this.start.y }; }
标签:dde span targe off box 样式 touch eth return
原文地址:https://www.cnblogs.com/yycc11/p/9530047.html