小程序防止遮罩层穿透

  最近弄小程序遮罩层穿透问题,网上好多资源设置catchtouchmove="preventD"即可,本人测试后好像还是不行,然后就找了其他方法,测试有效。

1、js ,data内初始化状态标识

showModalStatus: false

2、在相应的view 上加上判断代码

 class="{{showModalStatus?\'C_scroll\':\'\'}}"

3、css 代码

.C_scroll {
  top: 0px;
  left: 0px;
  width: 100%;
  height: 100vh;
  overflow: hidden;
  position: fixed;
  z-index: 0;
}

有兴趣的可以加杭州小程序交流群:497030311