forked from platypush/platypush
[UI] Fixed Autocomplete
behaviour on empty filter.
This commit is contained in:
parent
c88a9da3e6
commit
0055acad9d
1 changed files with 8 additions and 2 deletions
|
@ -25,8 +25,8 @@
|
||||||
v-for="(item, i) in visibleItems"
|
v-for="(item, i) in visibleItems"
|
||||||
@click="onItemSelect(item)"
|
@click="onItemSelect(item)"
|
||||||
>
|
>
|
||||||
<span class="matching">{{ item.substr(0, value.length) }}</span>
|
<span class="matching" v-if="value?.length">{{ item.substr(0, value.length) }}</span>
|
||||||
<span class="normal">{{ item.substr(value.length) }}</span>
|
<span class="normal">{{ item.substr(value?.length || 0) }}</span>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
@ -80,6 +80,9 @@ export default {
|
||||||
|
|
||||||
computed: {
|
computed: {
|
||||||
visibleItems() {
|
visibleItems() {
|
||||||
|
if (!this.value?.length)
|
||||||
|
return this.items
|
||||||
|
|
||||||
const val = this.value.toUpperCase()
|
const val = this.value.toUpperCase()
|
||||||
if (!val?.length)
|
if (!val?.length)
|
||||||
return this.showResultsWhenBlank ? this.items : []
|
return this.showResultsWhenBlank ? this.items : []
|
||||||
|
@ -125,6 +128,9 @@ export default {
|
||||||
},
|
},
|
||||||
|
|
||||||
valueIsInItems() {
|
valueIsInItems() {
|
||||||
|
if (!this.value)
|
||||||
|
return false
|
||||||
|
|
||||||
return this.items.indexOf(this.value) >= 0
|
return this.items.indexOf(this.value) >= 0
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue