Skip to content

Commit

Permalink
dropdown的close替代原检测是否关闭
Browse files Browse the repository at this point in the history
  • Loading branch information
lanrenbulan committed Mar 4, 2024
1 parent dc9efcf commit c839504
Showing 1 changed file with 9 additions and 14 deletions.
23 changes: 9 additions & 14 deletions select.js
Original file line number Diff line number Diff line change
Expand Up @@ -332,20 +332,6 @@ layui.define(['jquery', 'dropdown'],function(exports){
if (that.context.keyword !== '') {
searchInput.val(that.context.keyword).focus();
}

// 检测dropdown的面版是否已关闭
var i = setInterval(function() {
// 是否已展开
if (!elem.data('layui_dropdown_index_opened')) {
clearInterval(i);

that.context.keyword = '';
that.context.filteredOptions = null;
that.reloadDropdownData();

elem.removeClass('multiple-select-panel-opended')
}
}, 100);
},

click: function(data, elem) {
Expand Down Expand Up @@ -379,6 +365,15 @@ layui.define(['jquery', 'dropdown'],function(exports){

// false不关闭面板
return false;
},

close: function(elem) {
// 面板关闭后,清空关键词搜索
that.context.keyword = '';
that.context.filteredOptions = null;
that.reloadDropdownData();

elem.removeClass('multiple-select-panel-opended')
}
});
};
Expand Down

0 comments on commit c839504

Please sign in to comment.