2

I'm entirely new to Vue, and I've been coding for weeks now. I'm not so sure if I'm doing this right, but this is how I transfer data from one component to another:

enter image description here

The red arrow flow works, but I don't know how to send data in the green arrow after processing the red arrow data in the connection component.

What I want is to trigger a click event in the run test component (red box) and then send data to the connection component (green box) for processing. After the processing completes, the connection component then sends data back to the run test component to update the status.

Lawrence Cherone
  • 46,049
  • 7
  • 62
  • 106
dbybanez
  • 55
  • 1
  • 6
  • 1
    The simple solution is to use custom global eventbus, [example](https://www.digitalocean.com/community/tutorials/vuejs-global-event-bus) Or you can use vuex which is the state management plugin for vue.js [docs](https://vuex.vuejs.org/) , I know it can be overwhelming when you are begginner. – Sándor Bakos Aug 28 '20 at 16:09
  • Did you see the red arrow from `Run Test` to `index page`, you can do the same. i.e create a event in the parent component and emit it from the child. see this for more info https://stackoverflow.com/questions/43334796/pass-data-from-child-to-parent-in-vuejs-is-it-so-complicated#answers-header – Sowmyadhar Gourishetty Aug 28 '20 at 16:21
  • other solutions: 1: `event bus`, 2: emit/listen on `$root`, 3: uses `vuex`. – Sphinx Aug 28 '20 at 16:21
  • @Sphinx is right - those are all suitable solutions. But in the end you probably will find out how much easier everything is with Vuex. – Hexodus Aug 28 '20 at 22:06
  • I would suggest you to take some time and learn Vuex. It will make it much more easier. – Saaransh Menon Aug 29 '20 at 06:08

0 Answers0