[Vuejs]-VueJs filtering by JSON

0๐Ÿ‘

โœ…

I know this is old so you might have worked this out. This worked for me:

data(){
   return{
    filterName:'Warszawa'
  }
},
computed:{
   filteredName(){
    return this.titles
    .filter((title)=>{
     return item.title.match(this.filterName);
})

then

<div v-for="item in filteredName"></div>

Granted, for me, I was calling a JSON object from an API but I assume you are doing the same.

Leave a comment