optimized
This commit is contained in:
@ -231,8 +231,7 @@ class Dropdown {
|
||||
let item = this.source.find(it => it[valuekey] === selected);
|
||||
if (this.#options.input) {
|
||||
if (item == null) {
|
||||
item = {};
|
||||
item[valuekey] = selected;
|
||||
item = { [valuekey]: selected };
|
||||
}
|
||||
this.#label.value = selected;
|
||||
} else {
|
||||
@ -266,9 +265,7 @@ class Dropdown {
|
||||
const itemlist = selectedlist.map(v => {
|
||||
let item = source.find(it => it[valuekey] === v);
|
||||
if (item == null) {
|
||||
item = {};
|
||||
item[valuekey] = v;
|
||||
item[textkey] = v;
|
||||
item = { [valuekey]: v, [textkey]: v };
|
||||
}
|
||||
return item;
|
||||
});
|
||||
|
Reference in New Issue
Block a user