Search code examples
javascriptvuejs2splice

How Vuejs 2.6 to splice element of datarray as Observe?


I have data array like :

But I can not delete 1 element with splice like:

remove (index) {
 this.todos.splice(index, 1)
}

I found a way

 JSON.parse(JSON.stringify(todos))

and it is okey when I need to read data, but how to make splice ?

Thanks!


Solution

  • You need use some like this (manual):

    vm.items.splice(indexOfItem, 1, newValue)