用法:
**HTML**
<div class="box"
v-tap="(e)=>vueTouch('点击',e)"
v-longtap="(e)=>vueTouch('长按',e)"
v-swipeleft="(e)=>vueTouch('左滑',e)"
v-swiperight="(e)=>vueTouch('右滑',e)"
v-swipeup="(e)=>vueTouch('上滑',e)"
v-swipedown="(e)=>vueTouch('下滑',e)"
>{
{ name }}</div>
**js**
kim=new Vue({
el:"#app",
data:{
name:"开始"
},
methods:{
vueTouch:function(s,e){
this.name=s.name;
}
}
});
js核心内容
function vueTouch(el,binding,type){
var _this=this;
this.obj=el;
this.binding=binding;
this.touchType=type;
this.vueTouches={x:0,y:0};
this.vueMoves=true;
this.vueLeave=true;
this.longTouch=true;
this.vueCallBack=type