wireless-g
wireless-g

Reputation: 49

Vue.js filtering list with multiple checkboxes

I'm trying to work out how you can filter a v-for list using checkbox model array where you have multiple checkboxes ticked. Other examples I have found all do the same as my example here - just filter one checkbox at a time. Here is a simple demo of what I have so far - https://jsbin.com/fuzuzucike/1/edit?html,js,console,output as you can checkboxes 1-3 and a list of names.

If you click 1 it filters the name with id1 but then when you click 2 (with 1 still selected) no names appear. I would want names with ids 1 and 2 to show in this case. Am I missing something simple here or is it a case of having to create a custom filter to handle this functionality?

Many thanks.

Upvotes: 1

Views: 3401

Answers (1)

gurghet
gurghet

Reputation: 7707

Filters are deprecated, use computed properties: https://jsbin.com/jofediqifi/1/edit?html,js,console,output

Upvotes: 1

Related Questions