select2 多选情况下不自动关闭,并禁用 First Item 高亮

This commit is contained in:
thinkgem
2020-03-21 22:09:49 +08:00
parent f79b18a4b9
commit f08a252b51

View File

@@ -857,22 +857,23 @@ S2.define('select2/results',[
};
Results.prototype.highlightFirstItem = function () {
var $options = this.$results
.find('.select2-results__option[aria-selected]');
var $selected = $options.filter('[aria-selected=true]');
// Check if there are any selected options
if ($selected.length > 0) {
// If there are selected options, highlight the first
$selected.first().trigger('mouseenter');
} else {
// If there are no selected options, highlight the first option
// in the dropdown
$options.first().trigger('mouseenter');
}
this.ensureHighlightVisible();
// var $options = this.$results
// .find('.select2-results__option[aria-selected]');
//
// var $selected = $options.filter('[aria-selected=true]');
//
// // Check if there are any selected options
// if ($selected.length > 0) {
// // If there are selected options, highlight the first
// $selected.first().trigger('mouseenter');
// } else {
// // If there are no selected options, highlight the first option
// // in the dropdown
// $options.first().trigger('mouseenter');
// }
//
// this.ensureHighlightVisible();
// ThinkGem 禁用 First Item 高亮
};
Results.prototype.setClasses = function () {