原生js禁止页面滚动

    // 开启、禁止页面滚动
    bodyScroll: {
       e(e) { e.preventDefault();
// 注意此处代码片段必须这样提出来已保证传入下边两个事件的处理程序一样才生效,分别写到事件处理程序中不生效。
     },
     // 开启滚动 
     open() {
       document.body.removeEventListener(
'touchmove', this.e, false);
     },
    
// 禁止滚动
  
close() {
       document.body.addEventListener(
'touchmove', this.e, false);
    }
  }

原文地址:https://www.cnblogs.com/lanshengzhong/p/7991308.html