I have the following three components. Basically I need the submit event from the CustomForm component but its' only passed to the parent component. Is there an easy way to do this? I want to avoid using an event bus.
CustomForm.vue
<template>
<form @submit.prevent="submit">
<slot />
</form>
</template>
<script>
export default {
methods: {
submit() {
this.$emit('onSubmit')
}
}
}
</script>
FormHolder.vue
<template>
<div>
<CustomForm>
<slot />
<FormSubmit />
</CustomForm>
</div>
</template>
Page.vue
<template>
<FormHolder @onSubmit="submit">
My input fields...
</FormHolder>
</template>