Browse Source

fix(dropdown): 修复遮罩层在移动端的点击穿透问题 (#2206)

pull/2239/head
morning-star 2 months ago committed by GitHub
parent
commit
045ac836ba
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
  1. 8
      src/modules/dropdown.js

8
src/modules/dropdown.js

@ -532,7 +532,7 @@ layui.define(['jquery', 'laytpl', 'lay', 'util'], function(exports){
// 点击任意处关闭
_DOC.on(clickOrMousedown, function(e){
lay(_DOC).on(clickOrMousedown, function(e){
if(!dropdown.thisId) return;
var that = thisModule.getThis(dropdown.thisId)
if(!that) return;
@ -550,8 +550,12 @@ layui.define(['jquery', 'laytpl', 'lay', 'util'], function(exports){
) return;
}
if(e.type === 'touchstart' && options.elem.data(MOD_INDEX +'_opened')){
$(e.target).hasClass(STR_ELEM_SHADE) && e.preventDefault();
}
that.remove();
});
}, {passive: false});
// 基础菜单的静态元素事件
var ELEM_LI = '.layui-menu:not(.layui-dropdown-menu) li';

Loading…
Cancel
Save