AlloyFinger
AlloyFinger copied to clipboard
求教longtap如何阻止浏览器默认事件
longTap(evt) {
alert(11111111);
evt.preventDefault();
evt.stopPropagation();
},
tap() {
this.$router.push('/worksDetail');
}
尝试了上面的,但还是无效,此外这longtap和tap事件绑在同一个dom时,如何阻止longtap触发tap?
跟你碰到同样的问题,分享下拙见。自己去源码加个isLongTap判断
143行左右
this.isLongTap = false; this.longTapTimeout = setTimeout(function () { this.isLongTap = true; this.longTap.dispatch(evt); }.bind(this), 750);
210行左右
if(self.isLongTap){return false;} this.tapTimeout = setTimeout(function () { ... }
只在vue2里试了下tap和longTap,没测试其他的会不会有问题