同一页面 touchmove 之后,点击失效,第一次不行,之后可以
发布于 6 年前 作者 yongzhu 7900 次浏览 来自 问答

wxml

<view class=“index-order-container” bindtouchstart=“touchStart” bindtouchmove=“touchMove” bindtouchend=“touchEnd”>

js

touchStart: function (e) {

console.log(‘触摸开始事件!!’)

touchDot = e.touches[0].pageX; // 获取触摸时的原点

},

// 触摸移动事件

touchMove: function (e) {

const that = this;

console.log(e)

touchMove = e.touches[0].pageX;

console.log(“touchMove:” + touchMove + " touchDot:" + touchDot + " diff:" + (touchMove - touchDot)+‘time:’+time);

// 向左滑动  

if (touchMove - touchDot <= -40 ) {

console.log(‘向左滑动’);

that.doSwichTab(2)

}

// 向右滑动

if (touchMove - touchDot >= 40 ) {

console.log(‘向右滑动’);

that.doSwichTab(0)

}

},

// 触摸结束事件

touchEnd: function (e) {

console.log(‘触摸结束事件’)

},

当滑动之后,第一次点击就无效,之后点击才能生效。

麻烦官方大大,请查看下,是否为bug?

2 回复

麻烦给个相关的代码片段(https://developers.weixin.qq.com/miniprogram/dev/devtools/minicode.html),我们定位下问题

请问解决了吗

回到顶部