First, I am wondering whether I am on the right track with the patterns I am using for my application. Is it correct for me to create a reusable BaseForm component?
Another way to pose my question is: How do I model the parent component's data dynamically based on the child components I have included using slots?
I simply want to re use the same submit handler for all my forms. The submit handler should use the action and method props to determine how to configure axios, and the request body will be dynamic based on the BaseInput and BaseSelect components that are slotted within the BaseForm component.
Here's my sandbox example:
https://codesandbox.io/s/brave-chaplygin-9e5u2?file=/src/App.vue
I am stuck on the BaseForm.vue's handleSubmit method.
I could always just serialize the form data using vanilla JavaScript, but I feel that I should be doing it the Vue way. I am welcome to any opinions and advice. I am new to this framework, so I could be getting it totally wrong.