Select list should retain selected position when re-rendered

This commit is contained in:
Bartek Fabiszewski 2019-12-28 20:34:50 +01:00
parent d1ad811594
commit 76f3855c87

View File

@ -127,7 +127,7 @@ export default class uSelect {
* @param {string=} selected * @param {string=} selected
*/ */
setOptions(options, selected) { setOptions(options, selected) {
selected = selected || ''; selected = selected || this.element.value;
this.element.options.length = 0; this.element.options.length = 0;
if (this.hasHead) { if (this.hasHead) {
this.addHead(); this.addHead();