From a28b4bdb111175d39b2a2b31f2fee061ec5bbea9 Mon Sep 17 00:00:00 2001 From: morning-star <26325820+Sight-wcg@users.noreply.github.com> Date: Fri, 7 Mar 2025 15:59:05 +0800 Subject: [PATCH] =?UTF-8?q?fix(layer):=20=E6=94=B9=E8=BF=9B=E8=AE=BE?= =?UTF-8?q?=E7=BD=AE=E9=A1=B5=E9=9D=A2=E6=BB=9A=E5=8A=A8=E6=9D=A1=E9=80=BB?= =?UTF-8?q?=E8=BE=91=20(#2537)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * fix(layer): 改进设置页面滚动条逻辑 * chore: 移除多余参数 --------- Co-authored-by: 贤心 <3277200+sentsim@users.noreply.github.com> --- src/modules/layer.js | 22 ++++++++++++---------- 1 file changed, 12 insertions(+), 10 deletions(-) diff --git a/src/modules/layer.js b/src/modules/layer.js index 72df729c..12e2fb2d 100644 --- a/src/modules/layer.js +++ b/src/modules/layer.js @@ -1021,16 +1021,20 @@ ready.record = function(layero){ // 设置页面滚动条 ready.setScrollbar = function(index){ - doms.html.css('overflow', 'hidden').attr('layer-full', index); + doms.html.css('overflow', 'hidden'); }; // 恢复页面滚动条 -ready.restScrollbar = function(index){ - if(doms.html.attr('layer-full') == index){ - doms.html[0].style[doms.html[0].style.removeProperty - ? 'removeProperty' - : 'removeAttribute']('overflow'); - doms.html.removeAttr('layer-full'); +ready.restScrollbar = function(index) { + // 关闭和大小化, layer-full 处理 + var targetEl = $('.'+ doms[0]).filter(function(){ + var layero = $(this); + return layero.data('config').scrollbar === false + && layero.data('maxminStatus') !== 'min' + && layero.attr('times') !== String(index); + }); + if(targetEl.length === 0){ + doms.html.css('overflow', ''); } }; @@ -1230,9 +1234,7 @@ layer.full = function(index){ layero.data('maxminStatus', 'max'); ready.record(layero); // 记录当前尺寸、坐标 - if(!doms.html.attr('layer-full')){ - ready.setScrollbar(index); - } + ready.setScrollbar(index); setTimeout(function(){ var isfix = layero.css('position') === 'fixed';