From cc26b594985aad0627525b15292e6a421c50fe66 Mon Sep 17 00:00:00 2001 From: sunxb <470459819@qq.com> Date: Sun, 9 Oct 2022 16:46:04 +0800 Subject: [PATCH 1/2] =?UTF-8?q?=E4=BF=AE=E5=A4=8Dlayer=20closeBtn2?= =?UTF-8?q?=E7=9A=84=E6=A0=B7=E5=BC=8F=E9=97=AE=E9=A2=98=EF=BC=8C=E4=BF=AE?= =?UTF-8?q?=E5=A4=8D=E6=8B=96=E6=8B=BD=E5=8A=9F=E8=83=BD=E5=AF=B9=E9=BC=A0?= =?UTF-8?q?=E6=A0=87=E5=8F=B3=E9=94=AE=E5=8A=9F=E8=83=BD=E7=9A=84=E5=BD=B1?= =?UTF-8?q?=E5=93=8D=EF=BC=8C=E5=8E=BB=E9=99=A4prompt=E5=BC=B9=E5=87=BA?= =?UTF-8?q?=E7=A9=BA=E5=80=BC=E6=97=A0=E6=B3=95=E7=A1=AE=E8=AE=A4=E7=9A=84?= =?UTF-8?q?=E9=99=90=E5=88=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/css/modules/layer.css | 3 ++- src/modules/layer.js | 5 ++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/css/modules/layer.css b/src/css/modules/layer.css index 41c1b9e0..c53253ce 100644 --- a/src/css/modules/layer.css +++ b/src/css/modules/layer.css @@ -59,7 +59,8 @@ html #layuicss-layer{display: none; position: absolute; width: 1989px;} .layui-layer-setwin .layui-layer-maxmin:after{z-index: 0; margin: -5px 0 0 -1px;} .layui-layer-setwin .layui-layer-close{cursor: pointer;} .layui-layer-setwin .layui-layer-close:hover{opacity:0.7;} -.layui-layer-setwin .layui-layer-close2{position:absolute; right: -13px; top: -13px; padding: 3px; margin-left:0; color: #777; *right:-18px; _display:none;} +.layui-layer-setwin .layui-layer-close2{position:absolute; right: -28px; top: -28px; color: #fff; background-color: #787878; padding: 3px; border: 3px solid; width: 18px; height: 18px; font-size: 18px; font-weight: bolder; border-radius: 50%; margin-left: 0; *right:-18px; _display:none;} +.layui-layer-setwin .layui-layer-close2:hover{opacity: unset; background-color: #3888f6;} /* 按钮栏 */ .layui-layer-btn{text-align: right; padding: 0 15px 12px; pointer-events: auto; user-select: none; -webkit-user-select: none;} diff --git a/src/modules/layer.js b/src/modules/layer.js index 9ab219b5..395e63dd 100644 --- a/src/modules/layer.js +++ b/src/modules/layer.js @@ -668,6 +668,7 @@ Class.pt.move = function(){ //按下拖动元素 moveElem.on('mousedown', function(e){ + if (e.button) {return;} // 不是左键不处理 var othis = $(this) ,dict = {}; @@ -1236,9 +1237,7 @@ layer.prompt = function(options, yes){ ,resize: false ,yes: function(index){ var value = prompt.val(); - if(value === ''){ - prompt.focus(); - } else if(value.length > (options.maxlength||500)) { + if(value.length > (options.maxlength||500)) { layer.tips('最多输入'+ (options.maxlength || 500) +'个字数', prompt, {tips: 1}); } else { yes && yes(value, index, prompt); From 2ba9a934c29b5ad297bb7d03a1a4c647933206e5 Mon Sep 17 00:00:00 2001 From: sunxb <470459819@qq.com> Date: Sun, 9 Oct 2022 17:48:41 +0800 Subject: [PATCH 2/2] =?UTF-8?q?=E4=BC=98=E5=8C=96layer=E5=BC=B9=E5=87=BA?= =?UTF-8?q?=E7=9A=84=E4=B8=80=E4=BA=9B=E7=B1=BB=E5=9E=8B=E5=9C=A8=E5=BC=B9?= =?UTF-8?q?=E5=87=BA=E6=97=B6=E5=8E=9F=E5=A7=8B=E7=9A=84=E8=81=9A=E7=84=A6?= =?UTF-8?q?=E8=8A=82=E7=82=B9=E5=A4=B1=E5=8E=BB=E7=84=A6=E7=82=B9=EF=BC=8C?= =?UTF-8?q?=E9=81=BF=E5=85=8D=E5=BC=B9=E5=87=BA=E5=90=8E=E6=8C=89=E5=9B=9E?= =?UTF-8?q?=E8=BD=A6=E5=87=BA=E7=8E=B0=E7=9A=84=E4=B8=80=E4=BA=9B=E5=BC=82?= =?UTF-8?q?=E5=B8=B8=E7=8E=B0=E8=B1=A1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/modules/layer.js | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/src/modules/layer.js b/src/modules/layer.js index 395e63dd..d900a733 100644 --- a/src/modules/layer.js +++ b/src/modules/layer.js @@ -24,7 +24,7 @@ var isLayui = window.layui && layui.define, $, win, ready = { return GLOBAL.layer_dir || jsPath.substring(0, jsPath.lastIndexOf('/') + 1); }(), - config: {}, end: {}, events: {resize: {}}, minIndex: 0, minLeft: [], + config: {removeFocus: true}, end: {}, events: {resize: {}}, minIndex: 0, minLeft: [], btn: ['确定', '取消'], //五种原始层模式 @@ -173,7 +173,8 @@ var layer = { closeBtn: false, btn: false, resize: false, - end: end + end: end, + removeFocus: false }, (type && !ready.config.skin) ? { skin: skin + ' layui-layer-hui', anim: anim @@ -191,7 +192,8 @@ var layer = { type: 3, icon: icon || 0, resize: false, - shade: 0.01 + shade: 0.01, + removeFocus: false }, options)); }, @@ -204,7 +206,8 @@ var layer = { shade: false, resize: false, fixed: false, - maxWidth: 260 + maxWidth: 260, + removeFocus: false }, options)); } }; @@ -367,6 +370,9 @@ Class.pt.creat = function(){ ,body = $('body'); if(config.id && $('.'+ doms[0]).find('#'+ config.id)[0]) return; + if(config.removeFocus) { + document.activeElement.blur(); // 将原始的聚焦节点失焦 + } if(typeof config.area === 'string'){ config.area = config.area === 'auto' ? ['', ''] : [config.area, ''];