From f48b5115f0385049a1a31c1a1003b8ca0006e7e5 Mon Sep 17 00:00:00 2001 From: morning-star <1453017105@qq.com> Date: Wed, 13 Dec 2023 22:38:01 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=20select=20=E5=9C=A8=20IE10?= =?UTF-8?q?=20=E5=92=8C=2011=20=E4=B8=AD=E7=9A=84=E5=85=BC=E5=AE=B9?= =?UTF-8?q?=E6=80=A7=E9=97=AE=E9=A2=98=20(#1452)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * 修复 select 在 IE10 和 11 中的兼容性问题 close #1449 * update code --- src/modules/form.js | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/modules/form.js b/src/modules/form.js index e66275da..174c401b 100644 --- a/src/modules/form.js +++ b/src/modules/form.js @@ -626,7 +626,12 @@ layui.define(['lay', 'layer', 'util'], function(exports){ }; if(isSearch){ - input.on('input propertychange', search).on('blur', function(e){ + // #1449: IE10 和 11 中,带有占位符的 input 元素获得/失去焦点时,会触发 input 事件 + var eventsType = 'input propertychange'; + if(lay.ie && (lay.ie === '10' || lay.ie === '11') && input.attr('placeholder')){ + eventsType = 'keyup'; + } + input.on(eventsType, search).on('blur', function(e){ var selectedIndex = select[0].selectedIndex; thatInput = input; // 当前的 select 中的 input 元素