在不同情况下设置禁止滚动的遮罩层
1.在html设置禁止滚动的遮罩层:
1 /***滑动限制***/ 2 stop(){ 3 var mo=function(e){e.preventDefault();}; 4 document.body.style.overflow='hidden'; 5 document.addEventListener("touchmove",mo,false);//禁止页面滑动 6 }, 7 /***取消滑动限制***/ 8 move(){ 9 var mo=function(e){e.preventDefault();}; 10 document.body.style.overflow='';//出现滚动条 11 document.removeEventListener("touchmove",mo,false); 12 }
或者
<div class="cover" @touchmove.prevent></div>
2.在小程序:
<view catchtouchmove="ture"></view>
3.在uni-app:
<view @touchmove.stop.prevent ></view>

浙公网安备 33010602011771号