data(){
return {
handler: function(e) {
e.preventDefault();
}, //阻止body滑动
}
},
methods: {
closeTouch: function() {
document
.getElementsByTagName("body")[0]
.addEventListener("touchmove", this.handler, { passive: false }); //阻止默认事件
},
openTouch: function() {
document
.getElementsByTagName("body")[0]
.removeEventListener("touchmove", this.handler, { passive: false }); //打开默认事件
},
}