0
Rather than indicate the index by this.daySelected.indexOf(object)
, try to indicate directly from the v-for
.
You maybe iterate the daySelected
array using v-for
as follows:
<div v-for="(obj, index) in daySelected">
...
// use `index` to pass as a parameter of the `splice` method.
... deleteObj(index) ...
...
</div>
<script>
...
methods: {
deleteObj(index) {
this.daySelected.splice(index, 1);
}
}
...
</script>
Source:stackexchange.com