<div v-for="deck in decks" :key="deck._id" slot="content">
<div class="level">
<div class="level-left">
<div>
<p>{{ deck._id }}</p>
<p class="has-text-weight-semibold">{{ deck.title }}</p>
<p>Boards: {{ deck.board1 }}</p>
<p>Primary color: {{ deck.board1Color }}</p>
<p>
L/W/H: {{ deck.deckLength }}ft, {{ deck.deckWidth }}ft,
{{ deck.deckHeight }}ft
</p>
</div>
</div>
<div class="level-right">
<form @submit.prevent="deleteDeck">
<button type="submit" class="button">Delete</button>
</form>
</div>
</div>
<br />
</div>
I'm able to access this object's id within the v-for loop, but not in the method called by the delete button.
methods: {
deleteDeck() {
const deckId = this.deck._id;
alert(deckId);
}
}
The id of this individual deck will be passed into an axios delete request, but for now I'm just trying to figure out how to access it. this.id contains the id from the greater object that this object belongs to.
@submit.prevent="deleteDeck(deck)"+deleteDeck(deck) { /*use deck*/ }?