Currently, I am in the process of creating a dashboard for my Vue application and I have encountered an issue regarding how to manage the dashboard routing effectively.
The structure of my dashboard container component is as follows:
<template>
<div>
<side-nav />
<div>
<router-view />
</div>
</div>
</template>
The main objective is to ensure that different components are rendered while maintaining static navigation and other content.
My current route setup looks like this:
{
path: "/dashboard",
name: "Dashboard",
component: Dashboard,
children: [
{
path: "/dashboard/home",
component: AccountHome,
alias: "/dashboard"
},
{
path: "/dashboard/settings",
component: Settings
}
]
}
I am interested in learning about the correct approach to set a default component for rendering within the dashboard. At present, I would like the landing page URL after user authentication to be /dashboard
, displaying the AccountHome
component. While the alias method works, it may not be the optimal solution.
Without the alias, the router-view
does not contain any components, resulting in only the static dashboard elements being displayed.
Are there alternative methods I could explore to address this issue? Is there a standard practice for managing dashboard routing efficiently?