I'm facing an issue with a v-btn
component that gets its content from values deep inside a multi-dimensional array.
<div v-for="student in students">
<v-btn disabled v-for="tag in student.tags">{{tag}}</v-btn>
</div>
In this case, tags
is a sub-array.
I'm trying to update the button whenever these values change, but I'm unsure of how to achieve this.
I've attempted using Vue.set
as shown below:
// "this.students" is an array, and "this.students[index].tags" is a sub-array.
// I increase the length of the sub-array.
this.students[index].tags.length++;
// Next, I insert a new value at the end of the sub-array.
Vue.set(this.students[index].tags, this.students[index].tags.length - 1, value)
Although I can see the values and the length of the sub-array, this.students[index].tags
, changing when I print them to the console, the new button doesn't appear. Only after re-compiling the client-end does the new button show up.
Could someone guide me on how to re-render that button?
Thanks in advance!