小程序开发:canvas在画布上滑动,页面跟着滑动问题

微信小程序官方文档有说明,disable-scroll="true" 可以阻止页面下拉和滚动。这里有个坑,disable-scroll在真机上如果要生效,那么要给canvas绑定一个触摸事件才能生效。

必须绑定三个事件真机才能捕获到

<canvas disable-scroll="true" bindtouchstart="touchStart" bindtouchmove="touchMove" bindtouchend="touchEnd" canvas-id="canvas" class="canvas"></canvas>

posted @ 2019-04-28 15:54  一顿操作猛如虎  阅读(7453)  评论(0编辑  收藏  举报