[Vuejs]-Remove ANY Grid-Item on the click of an 'x' button that is within each item, my method only deletes the last one

0👍

First let the event handler know which step is being clicked

<button @click="removeStep(step)">Remove</button>

Then find that step in the array and remove it

methods: {
    removeStep(step) {
        const index = this.stepsGrid.indexOf(step);
        if (index >= 0) this.stepsGrid.splice(index, 1);
    }
}

Leave a comment