I am facing a challenge with using a dropdown menu within a loop to select the region for each office in my list of offices. The problem lies in passing the index value to the updateRegion
method so that I can correctly associate the selected region with the respective office.
Is there an alternative approach to solve this issue? I'm open to suggestions as I currently do not have a solution.
<template v-for="(office, index) in offices">
<v-flex xs12 class="mt-3" :key="index">
<v-card class="white--text">
<v-card-text>
<v-layout row wrap>
<v-flex xs12 sm4 pr-2>
<v-autocomplete
:value="office.region.id"
:items="regions"
:label="Region"
@change="updateRegion"
></v-autocomplete>
</v-flex>
</v-layout>
</v-card-text>
</v-card>
</v-flex>
</template>
<script>
methods: {
updateRegion(value) {
// How can I access the index value here?
}
}
</script>