[Vuejs]-How to filter on the property of an object in Vuejs

2👍

You pass name already here:

filteredByCategory(category.name)

But then try access name property again in filter function.

product.category === category.name

Change one of those lines

  1. Pass category object to – filteredByCategory(category)
  2. Or check category instead product.category === category

2👍

Dot notation actually is accepted with the ES6

function({ propHere })

other than that I see that you already pass the category.name to the function filteredByCategory, but you are still using category.name. So it becomes like ‘clothing’.name which is undefined, because string prototype doesn’t have such method.

Leave a comment