Keep search term in search input after commiting

This commit is contained in:
Nachtalb 2021-04-13 00:11:43 +02:00
parent e36ae64c83
commit 544594a7ad
No known key found for this signature in database
GPG Key ID: E48DF13C07055D92

View File

@ -3,11 +3,11 @@
<div class="input-wrapper">
<input
ref="searchInputField"
v-model="searchInput"
type="text"
name="search"
class="input"
placeholder="Search messages…"
@input="setSearchInput"
@blur="closeSearch"
/>
</div>
@ -97,10 +97,15 @@ export default {
searchInput: "",
};
},
methods: {
setSearchInput(event) {
this.searchInput = event.target.value;
watch: {
"$route.query.q"() {
this.searchInput = this.$route.query.q;
},
},
mounted() {
this.searchInput = this.$route.query.q;
},
methods: {
closeSearch() {
this.searchOpened = false;
},