I have a template like this :
<div id="vue-instance">
<ul>
<li v-for="item in inventory" v-on:click="say()" v-bind:class="{active:isActive}" > {{ item.name }} - ${{ item.price }}
</li>
</ul>
</div>
And from my "controller" :
var vm = new Vue({
el: '#vue-instance',
data: {
inventory: [
{name: 'MacBook Air', price: 1000},
{name: 'MacBook Pro', price: 1800},
{name: 'Lenovo W530', price: 1400},
{name: 'Acer Aspire One', price: 300}
],
isActive : false
},
methods: {
say: function () {
this.isActive = !this.isActive
}
}
});
With this when i click one item from the list, all items are affected to active class. My question is how to toggle individual element?
Thank you.