Tip # 3 Deleting Array index in Vue.js
Published in
1 min readMar 3, 2017
Version 2.2 brings a new way to remove a item from array
The standard way in javascript to remove a item from an Array by index, is using array.splice(index, 1)
remove (index) {
this.todos.splice(index, 1)
}
But now in Vue.js 2.2, Vue.delete can do that for you, too:
remove (index) {
this.$delete(this.todos, index)
}
It's not better or faster, just something Vue.delete couldn't do before 2.2.0.