0

I have a Vue instance - a form that uses a router that switches between several components.

  <div id="form">
        <router-view></router-view>                   
   </div>

Each route uses a different Vue component.

I would like to call a method on the form that will validate all form sections/routes.

For this I need to be able to access all my form components and run a Validate method on them, but because they are not direct children of the form I cannot access them. (only one component is loaded at a time - the one in the current route)

Is there a way to access the components that are not loaded in the route?

Thanks, Y.

Yaron
  • 1,655
  • 6
  • 20
  • 38
  • 1
    It might be helpful to see more code, or at the very least, your component structure. – Mahmud Adam May 09 '18 at 16:06
  • Share any live demo for this ? – Niklesh Raut May 09 '18 at 16:07
  • I cannot upload live code because the project is very long and complex but the basic structure is as I've shown: There's one route-view that switches between 15 different components. In any given time only the mounted component in the view is available as a child of the main component, while the other components aren't loaded until the route changes. Y. – Yaron May 10 '18 at 06:40

0 Answers0