微信小程序官方文檔有說明,disable-scroll="true" 可以阻止頁面下拉和滾動。這里有個坑,disable-scroll在真機上如果要生效,那么要給canvas綁定一個觸摸事件才能生效。
必須綁定三個事件真機才能捕獲到
<canvas disable-scroll="true" bindtouchstart="touchStart" bindtouchmove="touchMove" bindtouchend="touchEnd" canvas-id="canvas" class="canvas"></canvas>