Top

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 indexProject from "@/pages/dashbords/indexProject.vue"

 const routes: Array<RouteRecordRaw>= [
 {
    path: '/',
    name: 'home',
    component: BodyView,
    meta: {
      title: 'Default | Mofi - Premium Admin Template',
    },
    children: [
      {
        path: '',
        name: 'defaultRoot',
        component: indexDefault,
        meta: {
          title: 'Default | Mofi - Premium Admin Template',
        }
      }
    ]
  },
  {
    path: "/dashboards",
    component: BodyView,
    children: [
    {
        path: "dashboard_default",
        name: "default",
        component: indexDefault,
        meta: {
          title: 'Dashboards Default | Mofi - Premium Admin Template',
        }
      },
      {
        path: "dashboard_project",
        name: "project",
        component: indexProject,
        meta: {
          title: 'Dashboards CRM | Mofi - Premium Admin Template',
        }
      },
    ]
  },
  ]

const router = createRouter({
history: createWebHistory(process.env.BASE_URL),
routes
})

export default router