Working in Vue.js, my v-for
loop is set up to go through a list and generate buttons. Each button has a click event that should change the value of upUrl
to its index:
<div class="mt-3" v-for="(buttonPic, index) in buttonPics"
:key="buttonPic"
>
<button class="btn btn-sm btn-success"
@click="upUrl= index">
{{ buttonPic }} </button>
</div>
In the data()
section, I have upUrl:null
. However, upon checking in the Vue Google Chrome Console, I noticed that upUrl
never gets updated and remains as null
.
I attempted using
@click="upUrl= this.index">
but encountered an error message stating: 'index' is defined but never used
'.