In Vuejs, I would like to set an "active" class on my nav. The nav is built in a v-for loop like this:
<li v-for="item in arrNav" v-bind:class="{'active' : item.id }">
<a v-link="{ path: item.id }">{{ item.title}}</a>
</li>
here's the data:
arrNav: [{
'title': 'Home',
'id': 'home'
},
{
'title': 'About',
'id': 'about'
},
{
'title': 'Contact',
'id': 'contact'
}]
This is setting an "active" class on every li. I assume this is because item.id is returning true because it's a string. Is there a way to evaluate item.id to its variable name?