创建组件时禁止页面滚动:

created(){
    //禁止页面滑动
    document.body.addEventListener('touchmove', this.bodyScroll, { passive: false }); 
},

组件销毁时解除禁止:

destroyed(){
    // 解绑禁止页面滚动事件
    document.body.removeEventListener('touchmove', this.bodyScroll, { passive: false });
}

 bodyScroll方法:

bodyScroll(event){
    event.preventDefault();  
}

 

相关文章:

  • 2022-12-23
  • 2021-12-10
  • 2022-12-23
  • 2021-11-27
  • 2022-02-10
  • 2022-12-23
  • 2022-01-19
  • 2022-12-23
猜你喜欢
  • 2022-12-23
  • 2022-12-23
  • 2021-12-10
  • 2022-12-23
  • 2021-08-04
  • 2022-12-23
  • 2022-12-23
相关资源
相似解决方案