1👍
✅
You can create a simple (probably functional) component and use this instead of the normal <form>
.
// BaseForm.vue
<template>
<form @submit.prevent="onSubmit">
<slot />
</form>
</template>
<script>
export default {
props: {
onSubmit: {
type: Function,
required: true,
}
}
}
</script>
You won’t really save a lot of code, but you won’t have to think about it anymore. You could include the basic <button type=submit></button>
in here as well.
Source:stackexchange.com