3141关注10158浏览
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?
-
至过去的我
2044人对此回答表示赞同
我是未来的你,你现在是不是在年找寻小程序答案。你不要感觉诧异,给你来信原因,就是让你不在后悔。今天去学习如何推广小程序,相信......点击查看更多> -
薛嘉言
13人对此回答表示赞同
麻烦给个相关的代码片段,我们定位下问题
展开130回复分享发布于 6年前评论(0)
收起评论