[Vuejs]-Passing data to components and accessing data from parent using vue and vue router

0👍

Try moving your x-templates outside of the application template.

Also, the section element does not have a showForm property. You need to send your props into the components using the router. You will have to use a common source of truth for your isConfigured property to use it in both the app component and the router components.

So for an showForm property:

<script type="text/x-template" id="test">
  <section v-show="showForm">
    I am configured
  </section>
</script>

You would pass props in like this:

const routes =[
    {path: '/',component:  Norm, props: {showForm: isConfigured},
    {path:'/settings', component: Settings, props: {showForm: isConfigured} }
]

Finally, you do not need to declare your routes as child components of the app.

Leave a comment