- 41
- 0
手动禁止了,也能向上滑了,可是里面的bindtap事件触发不到了,有什么办法能解决呢
<view class="shades">
<view class="shade"></view>
<swiper class="swiper_tuan" autoplay="true" vertical="{{true}}" interval="{{3000}}" duration="{{200}}">
<block wx:for="{{group_order}}" wx:key="group_order">
<swiper-item class="swiper_tuan_num">
<view class="group">
<view class='group_user'>
<image class="head_img" src="{{item.avatar}}"></image>
<text class="head_name">{{item.alias}}</text>
</view>
<view class='surplus'>
<view class="surplus_text">还差
<text>{{item.cha_num}}人</text>拼成</view>
<view class="shengyu">剩余{{item.end_time}}</view>
</view>
<view class="join_group" data-groupid="{{item.id}}" catchtap='tapBuyNow' id="1">去参团</view>
</view>
</swiper-item>
</block>
</swiper>
</view>
.shades{
position: relative;
background: #fff;
}
.shade{
position: absolute;
background: transparent;
top: 0;
left: 0;
width: 100%;
height: 100%;
z-index: 5
}
- 共 0 条
- 全部回答
-
許下你聽不到的承諾 普通会员 1楼
要禁止Swiper手动滑动但不影响页面向上滑动,并且可以点击Swiper里面按钮,可以使用以下方法:
- 在Swiper组件的onTouchStart事件中,检查当前触摸点是否在Swiper的边界之外。如果不在边界之外,则继续滑动。
javascript Swiper.prototype.onTouchStart = function(e) { var touch = e.touches[0]; var swipeStartX = touch.clientX; var swipeStartY = touch.clientY; var swipeEndX = this.rightPosX; var swipeEndY = this.bottomPosY; if (swipeStartX < swipeEndX && swipeStartY < swipeEndY) { return; } // If you need to handle more cases, you can add more condition here. };- 在Swiper组件的onTouchEnd事件中,如果Swiper的滑动已经停止,则不再阻止滑动。
javascript Swiper.prototype.onTouchEnd = function(e) { var touch = e.touches[0]; var swipeStartX = touch.clientX; var swipeStartY = touch.clientY; var swipeEndX = this.rightPosX; var swipeEndY = this.bottomPosY; if (swipeStartX > swipeEndX && swipeStartY > swipeEndY) { return; } // If you need to handle more cases, you can add more condition here. };- 在Swiper组件的onTouchMove事件中,判断滑动的边界,阻止滑动。
javascript Swiper.prototype.onTouchMove = function(e) { var touch = e.touches[0]; var swipeStartX = touch.clientX; var swipeStartY = touch.clientY; var swipeEndX = this.rightPosX; var swipeEndY = this.bottomPosY; if (swipeStartX < swipeEndX && swipeStartY < swipeEndY) { return; } // If you need to handle more cases, you can add more condition here. };以上代码只是一个基础的示例,你可能需要根据你的具体需求进行修改和扩展。
- 扫一扫访问手机版
回答动态

- 神奇的四哥:发布了悬赏问题阿里云幻兽帕鲁服务器更新之后。服务器里面有部分玩家要重新创建角色是怎么回事啊?预计能赚取 0积分收益

- 神奇的四哥:发布了悬赏问题函数计算不同地域的是不能用内网吧?预计能赚取 0积分收益

- 神奇的四哥:发布了悬赏问题ARMS可以创建多个应用嘛?预计能赚取 0积分收益

- 神奇的四哥:发布了悬赏问题在ARMS如何申请加入公测呀?预计能赚取 0积分收益

- 神奇的四哥:发布了悬赏问题前端小程序接入这个arms具体是如何接入监控的,这个init方法在哪里进行添加?预计能赚取 0积分收益

- 神奇的四哥:发布了悬赏问题阿里云幻兽帕鲁服务器刚到期,是不是就不能再导出存档了呢?预计能赚取 0积分收益

- 神奇的四哥:发布了悬赏问题阿里云幻兽帕鲁服务器的游戏版本不兼容 尝试更新怎么解决?预计能赚取 0积分收益

- 神奇的四哥:发布了悬赏问题阿里云幻兽帕鲁服务器服务器升级以后 就链接不上了,怎么办?预计能赚取 0积分收益

- 神奇的四哥:发布了悬赏问题阿里云幻兽帕鲁服务器转移以后服务器进不去了,怎么解决?预计能赚取 0积分收益

- 神奇的四哥:发布了悬赏问题阿里云幻兽帕鲁服务器修改参数后游戏进入不了,是什么情况?预计能赚取 0积分收益
- 回到顶部
- 回到顶部

