微信小程序中遮罩层滚动穿透问题(view增加一个属性解决)

直奔正题: 遮罩层(蒙层)弹出的时候,不应该让遮罩层底下的内容能滚动,小程序中的最佳解决方案亲测如下:

<view class="container" catchtouchmove="ture"></view>

.container {
    background-color: #000000;
    position: fixed;
    top: 0;
    opacity: 0.6;
     100%;
    height: 100%;
    z-index: 3;
}

没错就是在遮罩层上加上catchtouchmove="ture",不需要控制任何class和样式等等(因模拟器无touch事件,需在真机测试)。

原文地址:https://www.cnblogs.com/lsongyang/p/13588563.html