Answer the question
In order to leave comments, you need to log in
Why are vue search values not being output?
I'm already implementing it for the second time, but now apparently I don't see something somewhere.
<input type="text" class="search-field" v-model="search" placeholder="Поиск посылок" autofocus />
<p> тут само собой отобразит - {{ search }} </p>
<hr>
<ul id="example-1">
<li v-for="item in filterStore" :key="item.id">
{{ item.id }} {{ item.name }} {{ item.surname }} {{ item.val }}
</li>
</ul>
// -----
export default {
name: 'Search',
data () {
return {
search: '',
posts: [
{
"id": 1,
"name": "Simon",
"surname": "Kamni",
"val": "asdf32"
},
{
"id": 2,
"name": "Arnold",
"surname": "Aebedev",
"val": "234gf"
},
{
"id": 3,
"name": "Lu",
"surname": "Bebedev",
"val": "sd234gf"
}
],
computed: {
filterStore: function () {
return this.posts.filter((post)=>{
return post.name.match(this.search);
})
}
}
}
}
}
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question