javascriptvue.jsvuejs2vue-componentlaravel-vue

Question: How to get an array index id? in Vuejs


Scenario: I have an array which possesses 4 object i need to display the index of the array can someone help me to do this

enter image description here

enter image description here


Solution

  • This is as simple as using index in your output:

    <tr v-for="(items,index) in addedArray" :key="items.DataID">
        <td>{{ index }}</td>
        ...
    

    You are already capturing the index in v-for="(items,index) in addedArray".