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 @@ ...@@ -85,31 +85,31 @@
} }
}, },
select(item) { select(item) {
this.items = []
if (item) { if (item) {
if (typeof item == 'string') { // if blurred without selecting an option if (typeof item != 'string') {
// TODO: sett timeout for å vente på siste forslag? this.$emit('submit', item)
item = {q: item, label: item}
let self = this
} setTimeout(() => {
if (item.q == this.$refs.autocomplete.searchInput) { self.$refs.autocomplete.$refs.input.select()
this.$emit('submit', item) this.items = []
this.suggesting = false
let self = this }, 1)
setTimeout(() => {
self.$refs.autocomplete.$refs.input.select()
this.items = []
this.suggesting = false
}, 1)
} }
} }
} }
}, },
methods: { methods: {
run_query(q) { run_query(q) {
this.suggesting = true 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) 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