Tutorial by Examples

In your method or any lifecycle hook that changes the array item at particuar index new Vue({ el: '#app', data:{ myArr : ['apple', 'orange', 'banana', 'grapes'] }, methods:{ changeArrayItem: function(){ //this will not work //myArr[2] ...
You can perform the same change instead of using Vue.$set by using the Array prototype's splice() new Vue({ el: '#app', data:{ myArr : ['apple', 'orange', 'banana', 'grapes'] }, methods:{ changeArrayItem: function(){ //this will not work ...
If yoi have nested array, the following can be done new Vue({ el: '#app', data:{ myArr : [ ['apple', 'banana'], ['grapes', 'orange'] ] }, methods:{ changeArrayItem: function(){ this.$set(this.myArr[1], 1, 'strawbe...
new Vue({ el: '#app', data:{ myArr : [ { name: 'object-1', nestedArr: ['apple', 'banana'] }, { name: 'object-2', nestedArr: ['grapes', 'orange'] } ] ...

Page 1 of 1