• h5禁止滚动穿透(页面)


                //打开遮罩(禁止滚动)

                openOverlay() {
                    this.showOverlay = true;
                    let uniPlatform = uni.getSystemInfoSync().uniPlatform;
                    // H5禁止滚动
                    if (uniPlatform == 'web') {
                        var mo = function(e) {
                            e.preventDefault();
                        };
                        
                        document.body.style.overflow = 'hidden';
                        document.addEventListener("touchmove", mo, false); //禁止页面滑动
                    }
                    
                },


                //关闭遮罩(开启滚动)
                closeOverLay: function() {
                    this.showOverlay = false;
                    let uniPlatform = uni.getSystemInfoSync().uniPlatform; //获取设备信息(判断是否为web设备)
                    if (uniPlatform == 'web') {
                        var mo = function(e) {
                            e.preventDefault();
                        };
                        console.log("document", document)
                        document.body.style.overflow = ''; //出现滚动条
                        document.removeEventListener("touchmove", mo, false);
                    }
                },

  • 相关阅读:
    git stash的使用方法
    0023【Edabit ★☆☆☆☆☆】Using the “&&“ Operator
    高速吹风机MM32SPIN0280主控单片机
    ES索引Json格式字段设计
    CSS|02 基本选择器
    docker搭建私有仓库并推送本地镜像
    WindowsAPI 进程和线程相关说明
    HBase之异步Replication机制
    SpringBoot+Vue3项目跨域配置及Set-Cookie:SameSite=Lax 问题
    机器学习的第一节基本概念的相关学习
  • 原文地址:https://blog.csdn.net/weixin_44805839/article/details/125598239