Routing
Routing is one of the most important aspects of VueJs, without it you cannot render any of you pages. When you install vue, it asks you if you want to include the router so that you do not have to build it from scratch. We recommend choosing the routing option while creating a vue project.
You can find router file on the following path:
theme >> src >> router >> index.ts
Below Given is an example of the type of code that you
will write to create paths for your router.
import { createRouter, createWebHistory, RouteRecordRaw } from 'vue-router'
import IndexDefault from "@/pages/dashboards/IndexDefault.vue"
import IndexEcommerce from "@/pages/dashboards/IndexEcommerce.vue"
const routes: Array<RouteRecordRaw>= [
{
path: '/',
name: 'home',
component: BodyView,
meta: {
title: 'Admiro - Premium Vue Admin Template',
},
children: [
{
path: '',
name: 'defaultRoot',
component: IndexDefault,
meta: {
title: 'Admiro - Premium Vue Admin Template',
}
}
]
},
{
path: "/dashboards",
component: BodyView,
children: [
{
path: "dashboard_default",
name: "default",
component: IndexDefault,
meta: {
title: 'Dashboards | Admiro - Premium Vue Admin Template',
}
},
{
path: "dashboard_ecommerce",
name: "ecommerce",
component: IndexEcommerce,
meta: {
title: 'Dashboards Ecommerce | Admiro - Premium Vue Admin Template',
}
}
]
},
]
const router = createRouter({
history: createWebHistory(process.env.BASE_URL),
routes
})
export default router