I want to use the value of #search
as the filter (only the name
field of JSON) for v-for
.
The text entered in #search
and how the filter will actually be indifferent to me, what I really want to know is how I use this result in v-for
.
champions:
[
{
"champion":{
"name": "Aatrox",
"img_url": "http://ddragon.leagueoflegends.com/cdn/6.24.1/img/champion/Aatrox.png"
}
},
{
"champion":{
"name": "Ahri",
"img_url": "http://ddragon.leagueoflegends.com/cdn/6.24.1/img/champion/Ahri.png"
}
}
]
<div class="container" id="container">
<div class="form-group">
<input type="search" id="search" class="form-control" placeholder="Busque por um campeão">
</div>
<div class="champion" v-for="champion in champions" :key="champion.champion.name">
<img class="champion_image" v-bind:src="champion.champion.img_url">
<div class="champion_title">{{champion.champion.name}}</div>
</div>
</div>