fix panel dropping issue about input drop-down box

This commit is contained in:
2023-04-01 02:25:10 +08:00
parent 671a075c48
commit 067d6252b2
2 changed files with 17 additions and 13 deletions

View File

@ -363,18 +363,14 @@ class Dropdown {
// const event = new InputEvent('type');
// inputSearch.dispatchEvent(event);
// }
if (options.input) {
this.#label.dispatchEvent(new InputEvent('type'));
} else if (options.search) {
if (!options.input && options.search) {
const search = panel.querySelector('.dropdown-search > input');
if (!nullOrEmpty(search?.value)) {
search.dispatchEvent(new InputEvent('type'));
} else {
this.#filllist(this.source);
return;
}
} else {
this.#filllist(this.source);
}
this.#filllist(this.source);
} else {
panel.classList.remove('active');
}
@ -507,7 +503,7 @@ class Dropdown {
sel.parentElement.replaceChild(drop.create(), sel);
}
return dom;
}
}
}
export default Dropdown;