Merge pull request #1558 from Leopoldthecoder/select-fix

Select: show dropdown when options are given in remote mode
pull/1577/head
baiyaaaaa 2016-12-06 16:38:08 +08:00 committed by GitHub
commit 5ef3a8597b
1 changed files with 10 additions and 3 deletions

View File

@ -129,8 +129,8 @@
if (this.loading) { if (this.loading) {
return this.t('el.select.loading'); return this.t('el.select.loading');
} else { } else {
if (this.remote && this.query === '') return false; if (this.remote && this.query === '' && this.options.length === 0) return false;
if (this.filterable && this.filteredOptionsCount === 0) { if (this.filterable && this.options.length > 0 && this.filteredOptionsCount === 0) {
return this.t('el.select.noMatch'); return this.t('el.select.noMatch');
} }
if (this.options.length === 0) { if (this.options.length === 0) {
@ -211,7 +211,7 @@
value(val) { value(val) {
if (this.multiple) { if (this.multiple) {
this.resetInputHeight(); this.resetInputHeight();
if (val.length > 0) { if (val.length > 0 || (this.$refs.input && this.query !== '')) {
this.currentPlaceholder = ''; this.currentPlaceholder = '';
} else { } else {
this.currentPlaceholder = this.cachedPlaceHolder; this.currentPlaceholder = this.cachedPlaceHolder;
@ -254,6 +254,13 @@
this.query = ''; this.query = '';
this.selectedLabel = ''; this.selectedLabel = '';
this.resetHoverIndex(); this.resetHoverIndex();
this.$nextTick(() => {
if (this.$refs.input &&
this.$refs.input.value === '' &&
this.selected.length === 0) {
this.currentPlaceholder = this.cachedPlaceHolder;
}
});
if (!this.multiple) { if (!this.multiple) {
this.getOverflows(); this.getOverflows();
if (this.selected) { if (this.selected) {