Currently, I am in the process of constructing a view that includes a primary component called ContentComponent
. This component acts as a container for a series of sub-components, each representing a form module. The list of forms include:
EvaluationForm
ExperienceForm
ContactForm
HobbiesForm
The main goal of this project is to create a comprehensive form that consolidates all required information into a single JavaScript object with a specific structure:
content: {
evaluation: {},
experience: [{}, {}, ...],
contact: {},
hobbies: [{}, {}, ...]
}
One challenge I am facing is how to extract data from each child component within the parent component. Currently, I am utilizing the ref
attribute on each component to access their respective data using this.$refs
. However, I am uncertain if this approach would work effectively when dealing with multiple instances of the same component. For instance, some forms have buttons that allow users to add additional instances of the same component (e.g., multiple hobbies or experiences). In such cases, how can I dynamically retrieve the values of these components as well?