微信小程序中遮罩层的滚动穿透问题

如果弹出层没有滚动事件:

<view wx:if="{{alert}}" catchtouchmove="myCatchTouch">
     <template is="alert" data="{{alertData}}" />
</view>
myCatchTouch: function () {
    console.log('stop user scroll it!');
    return;
},

如果弹出层有滚动事件,那么在弹出层出现的时候给底部的containerView加上一个class 消失的时候移除。

<view class="{{showModalView?'tripList_root':''}}">
.tripList_root{
    top:0px;
    left: 0px;
    width: 100%;
    height: 100%;
    overflow: hidden;
    position: fixed;
    z-index: 0;
}

猜你喜欢

转载自www.cnblogs.com/tuspring/p/9714719.html