When user check and uncheck item, in native select, option doesn't remove attribute selected=true.
You can fix it by:
var select = this.el;
select.querySelectorAll("option").forEach(function (item) {
item.removeAttribute("selected");
});
this.selectedOptions.forEach(function(item) {
var el = select.querySelector(`option[value="${item.data.value}"]`);
if (el){
//Change it, cause it works more correctly.
el.setAttribute("selected", "selected");
el.selected = true;
}
});
When user check and uncheck item, in native select, option doesn't remove attribute selected=true.
You can fix it by:
Or some better solution with indexOf, filter.