移动端弹出遮罩层禁止页面滚动,遮罩里面的框不允许滚动

在遮罩层添加 (前提使用vue)@touchmove.prevent

HTML:

    <!--plan A-->
    <div class="overlayer" @touchmove.prevent >
        <div class="popup">
            如果在这个div中滑动,触发的事件会经过overlayer,可以屏蔽滑动
        </div>
    </div>
    <!--plan B-->
    <div class="overlayer" @touchmove.prevent >
    </div>
    <div class="popup"  @touchmove.prevent>
        如果在这个div中滑动,触发的事件也会被禁用默认行为, 也可以屏蔽滑动
    </div>

 

posted @ 2019-01-16 16:36  一抹夏忧☆  阅读(2410)  评论(0编辑  收藏  举报