直奔正题: 遮罩层(蒙层)弹出的时候,不应该让遮罩层底下的内容能滚动,小程序中的最佳解决方案亲测如下:
<view class="container" catchtouchmove="ture"></view>.container {background-color: #000000;position: fixed;top: 0;opacity: 0.6;width: 100%;height: 100%;z-index: 3;}
没错就是在遮罩层上加上catchtouchmove="ture"
,不需要控制任何class和样式等等(因模拟器无touch事件,需在真机测试)。