I have an odd HTML setup that I need to loop through. I get my data in two parts from Firebase. There is a categories and a businesses set of data structured like so:
Businesses
-UniqueFirebaseID
cat: "food"
Categories
-IniqueFirebaseID
name: "food"
I then want to loop through my data like so (pardon the non-semantic markup):
<ul>
<li v-for="cat in categories">
<ul>
<li v-for="business in filteredByCat">{{business.name}}</li>
</ul>
</li>
</ul>
I am trying to put together a computed property to filter. The one below represents what I'm trying to do but not sure how to do it. Any suggestions?
computed: {
filteredByCat () {
return this.businesses.filter((element) => {
return element.cat.match(cat.name)
})
}
}
Vueguide that states this limitation and also the way around it.