Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
import admin from "@/views/admin";
import dashboards from "@/views/dashboards";
const routes = Array().concat(
{
path: "/",
name: "root",
redirect: {
name: "dashboards-home",
},
},
...admin,
...dashboards,
);
const router = createRouter({
history: createWebHistory(process.env.BASE_URL),
routes,
linkActiveClass: "",
linkExactActiveClass: "active",
});
export default router;
router.beforeEach((to: RouteLocationNormalized, from: RouteLocationNormalized, next: NavigationGuardNext) => {
// Each time route is changing, store previous route location and reset
// error from store.
if (from.name && to.name !== from.name && !isEqual(to.params, from.params)) {
store.commit("prevRoute", from);
}
store.commit("error", null);
import Details from "@/views/Details";
const routes = [
{
path: '/',
name: 'Home',
component: Home
},
{
path: '/services/:key',
name: 'Details',
component: Details,
},
]
const router = createRouter({
history: createWebHistory(process.env.BASE_URL),
routes
})
export default router
component: FormsShow,
name: 'form'
},
{
path: '/forms',
component: FormsIndex,
name: 'forms'
},
{
path: '/reports/:type?',
component: ReportsIndex,
name: 'reports'
}
]
const router = createRouter({
history: createWebHistory(basePath),
parseQuery: qs.parse,
stringifyQuery: qs.stringify,
routes
})
export default router
import { createRouter, createWebHistory } from 'vue-router'
import store from '../store/store'
export const router = new createRouter({
history: createWebHistory(),
routes: [
{
path: "/",
alias: "/chatList",
name: "chatList",
component: () => import("@/pages/ChatList.vue")
},
{
path: "/chat/:id",
name: "chat",
props: route => ({
chatId: Number(route.params.id),
}),
component: () => import("@/pages/MessageList.vue")
},