diff --git a/src/components/Autocomplete.vue b/src/components/Autocomplete.vue index f6d709484d1f110a3727515b3d240ebcb2029dd1..aa7712c2c7acdc1bd80b0acc1d10d28d05348f2a 100644 --- a/src/components/Autocomplete.vue +++ b/src/components/Autocomplete.vue @@ -29,7 +29,7 @@ <span class="search-hit"> {{data.item.label}} </span> - ({{{"b": "bm", "n": "nn", "bn": "bm, nn" }[data.item.lang] || ["søker...","fritekst","avansert søk"][data.item.search]}}) + ({{{"b": "bm", "n": "nn", "bn": "bm, nn" }[data.item.lang] || ["søker...","trunkert søk","avansert søk"][data.item.search]}}) </template> <template slot="no-data"> <div></div> @@ -83,12 +83,12 @@ if (/_|\*|\|/.test(q)) { search = 2 } - this.items.splice(0,1, {q: q, match: q, label: q, time: time, search: search}) + // Whitespace necessary in case option already exists in dropdown + this.items.splice(0,1, {q: q, label: q +" ", time: time, search: search}) } } else { - // Whitespace necessary in case option already exists in dropdown - this.items.push({q: q, match: q, label: q+" ", time: time, search: search}) + this.items.push({q: q, label: q, time: time, search: search}) } let self = this self.api.get('suggest?', {params: {q: q, dict: self.$parent.lang, n: 80, scope: 'w', stage: self.$parent.stage}}) @@ -101,7 +101,11 @@ suggestions.unshift({q: q, label: q, time: time, search: 2}) } - self.items = suggestions + if (!suggestions.length) { + self.items = [{q: q+"*", label: q, time: time, search: 1}] + } else { + self.items = suggestions + } } self.loading = false })