Can Vue.js detect the swapping of array elements in my data object?
data: {
list: [
'Foo',
'Bar',
'Test'
]
}
This is the method I am using to swap entries:
swapIndex: function(from, to) {
var first = this.list[from];
this.list[from] = this.list[to];
this.list[to] = first;
}
Check out the JsFiddle at this link.
If I swap the indices, I want to re-render the v-for
loop. Any suggestions on how to achieve this?
Appreciate any help. Thank you!