Merge pull request #3482 from guemax/update-search-text-when-clicking-on-suggestion

fix: update text in search field when clicking on suggestion
This commit is contained in:
Bnyro 2024-03-20 20:36:54 +01:00 committed by GitHub
commit 693ac366e6
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -1,7 +1,12 @@
<template> <template>
<div class="suggestions-container absolute"> <div class="suggestions-container absolute">
<ul> <ul>
<li v-for="(suggestion, i) in searchSuggestions" :key="i" @mouseover="onMouseOver(i)"> <li
v-for="(suggestion, i) in searchSuggestions"
:key="i"
@mouseover="onMouseOver(i)"
@click="setSelected(i)"
>
<router-link <router-link
class="suggestion" class="suggestion"
:class="{ 'suggestion-selected': selected === i }" :class="{ 'suggestion-selected': selected === i }"
@ -68,9 +73,6 @@ export default {
this.selected = i; this.selected = i;
} }
}, },
onClick(i) {
this.setSelected(i);
},
setSelected(val) { setSelected(val) {
this.selected = val; this.selected = val;
this.$emit("searchchange", this.searchSuggestions[this.selected]); this.$emit("searchchange", this.searchSuggestions[this.selected]);