Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

92
Views
VueJS navigate to child component

I have a button in a component that onclick will navigate to its child component.

Button code

<button class="summary" @click="navigateToSummary">
        <span>Summary</span>
</button>

methods:{
  navigateToSummary() {
      return this.$router.push({
        name: 'PortfolioSummary',
        params: { coinId: this.coinSummary.coinId },
      });
    },
}

Router code

  {
      name: 'AppPortfolio',
      path: '/portfolio',
      component: AppPortfolio,
      children: [
        {
          name: 'PortfolioSummary',
          path: ':coinId',
          component: PortfolioSummary,
          props: true,
        },
      ],
    },

On clicking the button, the url updates in the browser, but it doesnt navigate to the child component. What am I meant to change?

about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

Your AppPortfolio view requires it's own <router-view> where PortfolioSummary will be rendered.

Basically when you use nested child routes in this manner they require a router-view inside a router-view to settle your 2 tree deep setup, a 3 for deep tree example will requires 3 nested router-views, so on and so fourth.

  • App.vue

    <router-view>

    • AppPortfolio

      <router-view>

      • PortfolioSummary
about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!