How do I filter through an array using a computed property in Vue.js 2.0? This task was quite trivial in older versions of Vue, but now it is more involved. I am displaying data in a table:
<tr v-for="person in filterPeople">
<td>{{person.name}}</td>
<td>{{person.age}}</td>
</tr>
and I have an input field where I can filter through the names and ages. I am not sure what I am doing wrong here:
computed: {
filterPeople: function(){
var self = this
return this.people.filter(function(p){
return p.name.indexOf(self.searchDetails) > - 1
})
}
}
If I type in the input it does not filter the people by name or age as I expect. Demo: http://codepen.io/p-adams/pen/AXPKko