vue移动端页面弹出遮罩层时禁止页面滚动

      bodyScroll(event) {
          event.preventDefault()
      },
      /**禁止页面滑动*/
      noSliding() {
        document.body.style.overflow = 'hidden';
        document.addEventListener('touchmove', this.bodyScroll, false);//禁止页面滑动
      },
      /**允许页面滑动*/
      sliding() {
        document.body.style.overflow = '';//出现滚动条
        document.removeEventListener('touchmove', this.bodyScroll, false);
      },
发布了20 篇原创文章 · 获赞 0 · 访问量 130

猜你喜欢

转载自blog.csdn.net/qq_2422941992/article/details/104217505