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

197
Views
Nested Vue Subroutes don't load automatically

I have an application with a sidebar. As a default, when loading patient/:id I want to load the the Patient view, which on default should also load its sub-view PatientDashboard.

Inside the Patient view component, I have a router-view which should on default load the PatientDashboard-component.

However, every time I load the page to the route patient/:id I need to switch back and forth between teh sidebar buttons of PatientDashboard and Timeline to get my PatientDashboard-Component loaded.

So how do I get the default subroute to load the component on it's first load?

Patient-Component:

<template>
  <div">
    <ProfileSidebar :sidebar_elements="sidebar_elements"/>
    <div id="profile_content">
      <router-view :key="$route.fullPath" />
    </div>
  </div>
</template>

Router:

const routes = [
{
    path: "/patient/:patient",
    name: "Patient",
    component: Patient,
    props: true,
      children: [
        {
          path: "timeline",
          name: "Timeline",
          component: Timeline
        },
        {
          path: "",
          name: "PatientDashboard",
          component: PatientDashboard
        },
      ],

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

0

Adding a redirect to the main route solved it:

redirect: {
  name: "PatientDashboard"
},
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!