Vue Get Child Component Data

Posted on  by admin

Modified2 years, 5 months ago.

I am having Vue Application and I am loading different child component's based on the values selected from parent component . When I am clicking on submit button which is in parent component I want to get all the values of child component into parent. Please ignore syntax.

I want all the input field data of child component into submitData method of parent component. Vishal IngoleVishal Ingole. Alexis GatuingtAlexis Gatuingt.

  1. You can use scoped slots for that, something like inside firstComponent:. now you have access to shared data, you can provide that to your submit function.

  2. 44 gold badges2424 silver badges5151 bronze badges. 5151 bronze badges. Concept of VueJS can access children component via VUEJs component id, but is troublesome.Suggestion is use 1.

EventBus https://alligator.io/vuejs/global-event-bus/ (try to avoid for using this because it is hard to trace where your event need to listen and call when your front end code is have hundred of files)2.