AlloyFinger icon indicating copy to clipboard operation
AlloyFinger copied to clipboard

求教longtap如何阻止浏览器默认事件

Open 262060984 opened this issue 7 years ago • 1 comments

longTap(evt) {
      alert(11111111);
      evt.preventDefault();
      evt.stopPropagation();
    },
    tap() {
        this.$router.push('/worksDetail');
    }

尝试了上面的,但还是无效,此外这longtap和tap事件绑在同一个dom时,如何阻止longtap触发tap?

262060984 avatar May 09 '17 11:05 262060984

跟你碰到同样的问题,分享下拙见。自己去源码加个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,没测试其他的会不会有问题

Yeahgw avatar May 23 '17 06:05 Yeahgw