Currently, i have to add a SnackBar component in my website. The expected output is the snackbar will show up when the user click the submit button. How do i pass my snackbar component to my button located inside my Add.vue file ? This is because I want to reuse my snackbar component because there are multiple submission form.
SnackBar.vue inside component file
<template>
<div class="text-center ma-2">
<v-snackbar
v-model="snackbar"
>
{{ text }}
<template v-slot:action="{ attrs }">
<v-btn
color="pink"
text
v-bind="attrs"
@click="snackbar = false"
>
Close
</v-btn>
</template>
</v-snackbar>
</div>
</template>
<script>
export default {
data: () => ({
snackbar: false,
text: `Hello, I'm a snackbar`,
}),
}
</script>
Add.vue
<template>
<base-form title="Add">
<template v-slot:actions>
<v-btn
color="secondary"
type="submit"
>
<div>Save</div>
</v-btn>
</template>
</base-form>
</template>