forked from platypush/platypush
[Autocomplete UI] Better handling of blur
events.
This commit is contained in:
parent
1dfbe0c12d
commit
028f48ed49
1 changed files with 10 additions and 3 deletions
|
@ -10,7 +10,7 @@
|
|||
:value="value"
|
||||
@focus="onFocus"
|
||||
@input="onInput"
|
||||
@blur="onInput"
|
||||
@blur="onBlur"
|
||||
@keydown="onInputKeyDown"
|
||||
@keyup="onInputKeyUp"
|
||||
>
|
||||
|
@ -23,8 +23,7 @@
|
|||
:key="item"
|
||||
:data-item="item"
|
||||
v-for="(item, i) in visibleItems"
|
||||
@click="onItemSelect(item)"
|
||||
>
|
||||
@click="onItemSelect(item)">
|
||||
<span class="matching" v-if="value?.length">{{ item.substr(0, value.length) }}</span>
|
||||
<span class="normal">{{ item.substr(value?.length || 0) }}</span>
|
||||
</div>
|
||||
|
@ -150,6 +149,14 @@ export default {
|
|||
this.visible = true
|
||||
},
|
||||
|
||||
onBlur(e) {
|
||||
this.onInput(e)
|
||||
this.$nextTick(() => {
|
||||
if (this.valueIsInItems())
|
||||
this.visible = false
|
||||
})
|
||||
},
|
||||
|
||||
onItemSelect(item) {
|
||||
this.$emit("input", item)
|
||||
this.$nextTick(() => {
|
||||
|
|
Loading…
Reference in a new issue