optimized

This commit is contained in:
2023-04-06 00:08:03 +08:00
parent adb74b7441
commit c27d44872b
11 changed files with 314 additions and 91 deletions

View File

@ -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;
});