//1.一开始用这段代码,结果发现滚动都失效了,如果页面大于屏幕高度将无法滚动至底部,所以淘汰// document.addEventListener('touchmove', function(e) {// e.preventDefault();// });//2.改良后的代码,将该代码直接放在index.html文件下即可let self = this;document.addEventListener('touchstart', (e) => { self.moveY = e.targetTouches[0].pageY;})document.addEventListener('touchmove', (e) => { e.preventDefault(); let moveWidth = self.moveY - e.targetTouches[0].pageY; if (moveWidth !== 0) { document.body.scrollTop += moveWidth; }})
摘自:https://www.2cto.com/kf/201704/623753.html