I have a list with cards with some details of a record. When i click on a card i want to start the vuetify dialog and pass the record of the selected card to the dialog to edit the record.
I already tried the solution of Open a Vuetify dialog from a component template in VueJS
But for some reason if i have for instance 3 records when i click by first click it shows the first record and when i click for the second time it shows the second record in the dialog and when i click 3 or more times it shows the third record
The below code works except i now have to show a button on every line. I want it to work by some sort of click event on a card
Parent:
<template>
<v-container id="translist" v-if="this.transactions">
<v-layout align-center justify-center row wrap v-for="transaction in transactions" :key="transaction.id" class="mb-2">
<v-flex xs12>
<v-card>
<v-container fluid>
<v-flex xs12 text-xs-right>
<app-edit-transaction-dialog :transaction="transaction"></app-edit-transaction-dialog>
</v-flex>
<v-layout row >
.. some data
</v-layout>
</v-container>
</v-card>
</v-flex>
</v-layout>
</v-container>
</template>
Dialog / child:
<template>
<v-dialog v-model="dialog" fullscreen transition="dialog-bottom-transition" @keydown.esc="open = false" max-width="600px">
<template v-slot:activator="{ on }">
<v-btn flat color="black" class="v-btn--small" dark v-on="on">
<v-icon small>edit</v-icon>
</v-btn>
<v-card>
<v-card-text>
<v-form class="px-3" ref="form">
<v-text-field
label="Omschrijving"
v-model="editTransaction.description"
prepend-icon="folder"
required
></v-text-field>
</v-form>
</v-card-text>
</v-card>
</v-dialog>
</template>
<script>
export default {
props: ['transaction'],
data () {
return {
dialog:false,
editTransaction:this.transaction,
}
}
}
</script>
i want to click on the card to start the dialog and it shows the record which i clicked on