0

I have an app where users create a list of patients. Each patient (child component) contains a name and age. The app will calculate the number of patients and sum of all of the patient's age. How would I pass information from the child component to the parent component?

Note - In my <report> component I am currently hard coding the total-age attribute value to 0.

Currently, I have an addPatient() method addd to my Vue instance which pushes null into the patients array. I feel like I should be pushing something else other then null into this array. I have a v-for for each patients.

https://codepen.io/anon/pen/pOgdmW

Jon
  • 8,205
  • 25
  • 87
  • 146
  • Possible duplicate of [Pass data from child to parent in Vuejs (is it so complicated?)](https://stackoverflow.com/questions/43334796/pass-data-from-child-to-parent-in-vuejs-is-it-so-complicated) – Daniel Beck Aug 25 '18 at 15:31
  • Or https://stackoverflow.com/questions/44088646/passing-data-from-child-to-parent-component-in-vue or https://stackoverflow.com/questions/40410332/vuejs-access-child-components-data-from-parent or https://stackoverflow.com/questions/44389168/vue-js-passing-events-up-to-parents-in-components – Daniel Beck Aug 25 '18 at 15:33

0 Answers0