This commit is contained in:
郑敏 2018-06-07 09:58:13 +08:00
parent 73b01ee06b
commit 21f6940672
2 changed files with 7 additions and 5 deletions

View file

@ -58,7 +58,7 @@
default: false default: false
}, },
initialLabel: { initialLabel: {
type: String, type: [String, Number, Array],
}, },
values: { values: {
type: Array, type: Array,

View file

@ -351,7 +351,7 @@
}); });
}); });
} }
let hasDefaultSelected = slotOptions.some(option => this.query === option.key);
for (let option of slotOptions) { for (let option of slotOptions) {
const cOptions = option.componentOptions; const cOptions = option.componentOptions;
@ -375,11 +375,13 @@
if (cOptions.children.length > 0) selectOptions.push({...option}); if (cOptions.children.length > 0) selectOptions.push({...option});
} else { } else {
// ignore option if not passing filter // ignore option if not passing filter
const optionPassesFilter = this.filterable ? this.validateOption(cOptions) : option; if (!hasDefaultSelected) {
if (!optionPassesFilter) continue; const optionPassesFilter = this.filterable ? this.validateOption(cOptions) : option;
if (!optionPassesFilter) continue;
}
optionCounter = optionCounter + 1; optionCounter = optionCounter + 1;
selectOptions.push(this.processOption(option, selectedValues, optionCounter === currentIndex)); selectOptions.push(this.processOption(option, selectedValues, false));
} }
} }