Answer the question
In order to leave comments, you need to log in
How to use v-model and value in one input?
There is
<input type="search" placeholder="Поиск" class="search__input" v-model="search" @keyup.enter="onSearchLineChanged(search)">
which sends the search value to the state (Vuex) on the onSearchLineChanged(search) event. In another component, on click, this search is replaced in state with a different value. Answer the question
In order to leave comments, you need to log in
In the components, watch the value from vuex, something like this (yes, instead of different components, there are several instances of one, but I think the point is clear):
watch: {
'$store.state.search'(val) {
this.search = val;
},
},
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question