Keep search term in search input after commiting
This commit is contained in:
parent
e36ae64c83
commit
544594a7ad
@ -3,11 +3,11 @@
|
|||||||
<div class="input-wrapper">
|
<div class="input-wrapper">
|
||||||
<input
|
<input
|
||||||
ref="searchInputField"
|
ref="searchInputField"
|
||||||
|
v-model="searchInput"
|
||||||
type="text"
|
type="text"
|
||||||
name="search"
|
name="search"
|
||||||
class="input"
|
class="input"
|
||||||
placeholder="Search messages…"
|
placeholder="Search messages…"
|
||||||
@input="setSearchInput"
|
|
||||||
@blur="closeSearch"
|
@blur="closeSearch"
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
@ -97,10 +97,15 @@ export default {
|
|||||||
searchInput: "",
|
searchInput: "",
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
methods: {
|
watch: {
|
||||||
setSearchInput(event) {
|
"$route.query.q"() {
|
||||||
this.searchInput = event.target.value;
|
this.searchInput = this.$route.query.q;
|
||||||
},
|
},
|
||||||
|
},
|
||||||
|
mounted() {
|
||||||
|
this.searchInput = this.$route.query.q;
|
||||||
|
},
|
||||||
|
methods: {
|
||||||
closeSearch() {
|
closeSearch() {
|
||||||
this.searchOpened = false;
|
this.searchOpened = false;
|
||||||
},
|
},
|
||||||
|
Loading…
Reference in New Issue
Block a user