vue 打开弹框,底部页面禁止滑动

/*解决iphone页面层级相互影响滑动的问题*/

closeTouch:function(){

document.getElementsByTagName("body")[0].addEventListener('touchmove',this.handler,{passive:false});//阻止默认事件

},

openTouch:function(){

document.getElementsByTagName("body")[0].removeEventListener('touchmove',this.handler,{passive:false});//打开默认事件

}

如果点击阴影就关闭的时候可以加上事件监听

watch:{

signReasonVisible:function(newvs,oldvs){//picker关闭没有回调函数,所以侦听该属性替代

console.log(newvs,oldvs)

if(newvs){

this.closeTouch();

console.log('关闭滑动')

}else{

this.openTouch();

console.log('打开滑动')

}

}

},

评论

h
hw_7864

⭐️ Admin快速开发: https://show.cool-admin.com/

赞 0
h
hw_7864

⭐️ 官方文档: https://cool-js.com

赞 0
h
hw_7864

⭐️ chatgpt在线体验: https://cool-js.com/ai/chat-vip/index.html?r=helloworld

赞 0