disableScroll=true在 ios设备页面禁止滚动无效
发布于 6 年前 作者 mayong 530 次浏览 来自 问答

page.json设置disableScroll=true,在页面中存在canvas,且canvas上绑定了事件bindtouchstart。在ios设备,页面整体不能上下滚动无效。canvas上没有绑定事件bindtouchstart 则可以起作用。代码如下:

<!--index.wxml-->
<view class="container">
  <canvas class="pic" disable-scroll="true" bindtouchstart='clickPos' canvas-id="firstCanvas"></canvas>
</view>
page {
  height: 100%;
}
 
.container {
  width: 100%;
  height: 100%;
  box-sizing: border-box;
  background: lightblue;
  overflow: hidden;
}
 
.pic {
  margin: 0 auto;
  width: 355px;
  height: 225px;
  border-radius: 8px;
  border: solid 2px #000;
}
//index.js
//获取应用实例
const app = getApp()
 
Page({
  data: {
    
  },
  clickPos(e){
    console.log(e)
  },
  touchMv(e){
    console.log(e)
  }
})

3 回复

请问有结论了吗?

wechatide://minicode/myJiBMm96OY7

回到顶部