longtap.vue /*** 长按事件*/ longTouch:function (event) { var tick = 0,clock,_this=this; $('#longtapbtn').addClass('onpress'); clock = setInterval(function () { tick++; if(tick=60){ clearInterval(clock); _this.remoteOpen();//要执行的操
/** * 长按事件 */ longTouch:function (event) { var tick = 0,clock,_this=this; $('#longtapbtn').addClass('onpress'); clock = setInterval(function () { tick++; if(tick>=60){ clearInterval(clock); _this.remoteOpen();//要执行的操作 tick=0; $('#longtapbtn').removeClass('onpress'); } },10); event.event.preventDefault();//取消浏览器、微信浏览器默认事件 $('#longtapbtn').on('touchend',function (e) { $('#longtapbtn').removeClass('onpress'); clearInterval(clock); tick = 0; }); }