微信开发者工具,andriod,都可以正常使用,老大给了iphone 测试时禁止滑动之后就不能开始滑动了
stopScroll () {
let bodyScroll=function(e){e.preventDefault();};
document.body.style.overflow = 'hidden'
document.addEventListener('touchmove', this.bodyScroll, false)
},
startScroll () {
let bodyScroll=function(e){e.preventDefault();};
document.body.style.overflow = ''// 出现滚动条
document.removeEventListener('touchmove', this.bodyScroll, false)
},
查了好久才知道,这个 let bodyScroll=function(e){e.preventDefault();}; 要是同一个、
于是改为
bodyScroll(event) {
event.preventDefault()
},
stopScroll () {
document.body.style.overflow = 'hidden'
document.addEventListener('touchmove', this.bodyScroll, false)
},
startScroll () {
document.body.style.overflow = ''// 出现滚动条
document.removeEventListener('touchmove', this.bodyScroll, false)
},