uniapp H5禁止两个滚动同时触发

  1. 在蒙板上加上事件<view class="mask"@touchmove.stop.prevent="moveHandle"></view>
    moveHandle(){}, 但是滚动的底部内容会顶置

2.控制底层不给滚动, 同样的滚动的底部内容会顶置


<view :class="mask ? 'tl-show': ''">

data() {
    return {
      mask: false,
  }
}

// 如果要显示遮罩层,那么用css控制底部的不允许滚动。

.tl-show{
  overflow: hidden;
  position:fixed;
  height: 100%;
  width: 100%;
}

转自: https://www.jianshu.com/p/a1e5177e553f

最后的解决方法, @touchmove.stop.prevent 然后弹窗里面再加上scroll-view , 但是还有个小问题就是滚到底部, 底层还是会滚下去


image.png
image.png

滚下是报错了 Ignored attempt to cancel a touchmove event with cancelable=false, for examp
解决方法如下:
我们只需要将滑动报错的标签上加上一个样式即可 touch-action: none;
touch-action :当你触摸并按住触摸目标时候,禁止或显示系统默认菜单。
touch-action取值有一下两种
none:系统默认菜单被禁用
default:系统默认菜单不被禁用

1.添加样式更改:

将滑动报错的标签样式添加: touch-action: none;

或者设置全局公共样式: *{touch-action: none;}

原文链接:https://blog.csdn.net/qq_38942978/article/details/105635735

最后编辑于
©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。