【element】解决element弹框组件el-dialog导致页面抖动问题:


一、问题:

在这里插入图片描述

二、解决:
【法1】 lock-scroll

在这里插入图片描述

【法2】main.js

在这里插入图片描述

ElementUI.Dialog.props.lockScroll.default = false;
【法3】修改body样式:

在这里插入图片描述

let mo=function(e){
    
    e.preventDefault();};

stop(){
    
    
	document.body.style.overflow='hidden';
	document.body.style.position='fixed';
	document.body.style.width='100%';
	document.addEventListener("touchmove",mo,false);//禁止页面滑动
},
move(){
    
    
	document.body.style.overflow='';//出现滚动条
	document.body.style.position='initial';
	document.body.style.height='1006px';
	document.removeEventListener("touchmove",mo,false);
},

猜你喜欢

转载自blog.csdn.net/weixin_53791978/article/details/131354996
今日推荐