微信公众号 --- 禁止下拉
文章目录
微信公众号 禁止下拉
methods: {
noPullDown:function(selector){
//禁止页面拖动
document.querySelector('body').addEventListener('touchmove', function (e) {
console.log('禁止下拉出现网页来源信息')
if(!selector) {
e.preventDefault()
} else {
// 如果需要部分区域可以滑动,则需传入需要滑动地方的类名
if (!document.querySelector(selector).contains(e.target)) {
e.preventDefault()
}
}
}, { passive: false })
},
}
mounted(){
this.noPullDown()
}
评论
登录后参与技术讨论,分享你的经验与见解。
登录 / 注册暂无评论