vendredi 23 février 2018

vuejs onclick event to return item id in v-for loop

I need to display item id in a v-for which is currently returning undefined at console: here is the code:

            <ul class="list-group-item" v-for="(st,index) in stock">
             <li @click="changeMenu(st)"></li> 
              </ul>

And the test data:

[ { "id": 1, "code": "m009", "description": "flavour", "has_conversions": 0, "name": "milk", "selling_tax": 16, "selling_uom": null, "stocking_uom": 1, "prices": [ { "stock_item_id": 1, "unit_conversion_id": 1, "inclusive_price": 250 } ], "stock": null, "conversions": [] }, { "id": 2, "code": "w3455", "description": "good", "has_conversions": 0, "name": "wheat", "selling_tax": 16, "selling_uom": null, "stocking_uom": 1, "prices": [ { "stock_item_id": 2, "unit_conversion_id": 1, "inclusive_price": 155 } ], "stock": null, "conversions": [] },



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire