Array:
According VUE official website:
Array Modified:
Modify the value of an array element:
Vue.set(this.items, indexOfItem, newValue);
this.$set(this.items, indexOfItem, newValue);
this.items.splice(indexOfItem, 1, newValue);
Modifying the length of the array: vm.items.splice (newLength);
Object:
Responsive to an array of newly added attributes:
Vue.set(vm.userProfile, 'age', 27);
vm.$set(vm.userProfile, 'age', 27);
While adding more properties:
vm.userProfile = Object.assign({}, vm.userProfile, { age: 27, favoriteColor: 'Vue Green' })