Skip to content
Snippets Groups Projects
Commit ad623849 authored by Henrik Askjer's avatar Henrik Askjer
Browse files

Add full text search option while waiting for debounce

parent 323dc61e
No related branches found
No related tags found
No related merge requests found
......@@ -85,31 +85,31 @@
}
},
select(item) {
this.items = []
if (item) {
if (typeof item == 'string') { // if blurred without selecting an option
// TODO: sett timeout for å vente på siste forslag?
item = {q: item, label: item}
}
if (item.q == this.$refs.autocomplete.searchInput) {
this.$emit('submit', item)
let self = this
setTimeout(() => {
self.$refs.autocomplete.$refs.input.select()
this.items = []
this.suggesting = false
}, 1)
if (typeof item != 'string') {
this.$emit('submit', item)
let self = this
setTimeout(() => {
self.$refs.autocomplete.$refs.input.select()
this.items = []
this.suggesting = false
}, 1)
}
}
}
},
methods: {
run_query(q) {
this.suggesting = true
this.items = []
if (this.items[0]) {
if (this.items[0].lang) {
this.items.unshift({q: q, label: q})
}
else {
this.items[0] = {q: q, label: q}
}
}
this.debounced(q, this)
}
},
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment