I have a component named task that contains a row of form inputs relating to the task. tasks is retrieved from a GET JSON request (existing entries).
<task v-for="task in tasks" :task="task"></task>
Now, I want to have a button to add a new blank row of inputs so they can add new entries.
<button type="button" @click="addTask()">New</button>
I tried unshifting an empty object to the tasks:
addTask() {
this.tasks.unshift({});
},
However, this just duplicates the last row of my tasks rather than adding a new row to the beginning of the tasks.
What's the best way to prepend items to an existing list?