[Vuejs]-Vue.js When applying multiple filters a list, how can you display a count/total of the results

2👍

You can use a computed property and $eval.

{
  computed: {
    filteredPeople: function () {
      return this.$eval("person in people | hairFilter 'red'| genderFilter 'male'");
    }
  }
}

Then in your template do like:

<h1>Results {{ filteredPeople.length }}</h1>
<ul>
  <li v-for="person in filteredPeople">{{ person.name }}</li>
</ul>

Leave a comment