I am trying to build a reusable component that called v-dialog.
The idea is that I when the the dialog pop up there will be consist of 2 buttons which is called submit and cancel.
For the submit button of dialog component will be linked with different actions based on user clicks which button.
For example button A will call function name A and button B will call function name B and so on when user clicks on submit button of the dialog.
Let's say this is a component file I called DialogReusable.vue
<v-dialog
v-model="dialog"
persistent
max-width="300"
>
<v-card>
<v-card-title
class="text-h5"
style="word-break: break-word"
>
Title
</v-card-title>
<v-card-actions>
<v-spacer />
<v-btn
color="green darken-1"
text
@click="dialog = false"
>
Cancel Button
</v-btn>
<v-btn
class="primary"
@click="functionSubmits()"
>
Submit
</v-btn>
</v-card-actions>
</v-card>
</v-dialog>
And this is the parent file that I called MainParent.vue
For this file it has like 3 buttons which link to different function.
When user clicks on each button the Dialog should appears and when user clicks on the submit button of the dialog then it will call the respective function name that I set @click on each button.
<v-btn
v-if="condition"
color="primary"
dark
@click="functionA()"
>
Function A
</v-btn>
<v-btn
v-if="condition"
class="primary"
@click="functionB()"
>
Function B
</v-btn>
<v-btn
v-if="condition"
class="primary"
@click="functionC()"
>
Function C
</v-btn>