From b6bd3850a95f7d18bc45631f04859560965a6faa Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=B4=A4=E5=BF=83?= <3277200+sentsim@users.noreply.github.com> Date: Sun, 30 Mar 2025 23:35:56 +0800 Subject: [PATCH] =?UTF-8?q?fix(form):=20=E4=BF=AE=E5=A4=8D=20input=20?= =?UTF-8?q?=E8=AE=BE=E7=BD=AE=20`lay-vertype=3D"tips"`=20=E9=AA=8C?= =?UTF-8?q?=E8=AF=81=E6=97=B6=20tips=20=E5=B1=82=E5=AE=9A=E4=BD=8D?= =?UTF-8?q?=E5=BC=82=E5=B8=B8=E9=97=AE=E9=A2=98=20(#2605)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/modules/form.js | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/src/modules/form.js b/src/modules/form.js index dee5cc28..96358e79 100644 --- a/src/modules/form.js +++ b/src/modules/form.js @@ -863,7 +863,7 @@ layui.define(['lay', 'layer', 'util'], function(exports){ var selected = $(select.options[select.selectedIndex]); // 获取当前选中项 var optionsFirst = select.options[0]; - if(othis.closest('[lay-ignore]').length > 0) return othis.show(); + if (othis.closest('[lay-ignore]').length) return othis.show(); var isSearch = typeof othis.attr('lay-search') === 'string' var isCreatable = typeof othis.attr('lay-creatable') === 'string' && isSearch @@ -1028,7 +1028,7 @@ layui.define(['lay', 'layer', 'util'], function(exports){ // 若为开关,则对 title 进行分隔解析 title = skin === 'switch' ? title.split('|') : [title]; - if(othis.closest('[lay-ignore]').length > 0) return othis.show(); + if (othis.closest('[lay-ignore]').length) return othis.show(); // 处理 IE8 indeterminate 属性重新定义 get set 后无法设置值的问题 if(needCheckboxFallback){ @@ -1111,7 +1111,7 @@ layui.define(['lay', 'layer', 'util'], function(exports){ var disabled = this.disabled; var skin = othis.attr('lay-skin'); - if(othis.closest('[lay-ignore]').length > 0) return othis.show(); + if (othis.closest('[lay-ignore]').length) return othis.show(); if(needCheckboxFallback){ toggleAttribute.call(radio, 'lay-form-sync-checked', radio.checked); @@ -1301,11 +1301,12 @@ layui.define(['lay', 'layer', 'util'], function(exports){ // 提示层风格 if (verType === 'tips') { layer.tips(errorText, function() { - if (othis.closest('[lay-ignore]').length > 0) { - return othis; - } else if(isForm2Elem) { - return othis.next(); + if (!othis.closest('[lay-ignore]').length) { + if(isForm2Elem) { + return othis.next(); + } } + return othis; }(), {tips: 1}); } else if(verType === 'alert') { layer.alert(errorText, {title: '提示', shadeClose: true});