42 lines
1,013 B
TypeScript
42 lines
1,013 B
TypeScript
import { createRouter, createWebHashHistory } from "vue-router";
|
|
import HomeView from "../views/HomeView.vue";
|
|
import RuleView from "../views/RuleView.vue";
|
|
import JdrView from "../views/JdrView.vue";
|
|
|
|
const router = createRouter({
|
|
history: createWebHashHistory(import.meta.env.BASE_URL),
|
|
routes: [
|
|
{
|
|
path: "/",
|
|
name: "home",
|
|
component: HomeView,
|
|
},
|
|
{
|
|
path: "/jdr/:jdr/rules/:category/:filepath",
|
|
component: RuleView,
|
|
},
|
|
{
|
|
path: "/jdr/:jdr/",
|
|
component: JdrView,
|
|
},
|
|
{
|
|
path: "/about",
|
|
name: "about",
|
|
// route level code-splitting
|
|
// this generates a separate chunk (About.[hash].js) for this route
|
|
// which is lazy-loaded when the route is visited.
|
|
component: () => import("../views/AboutView.vue"),
|
|
},
|
|
],
|
|
scrollBehavior(to, from, savedPosition) {
|
|
if (to.hash) {
|
|
return {
|
|
el: to.hash,
|
|
behavior: "smooth",
|
|
top: 64,
|
|
};
|
|
}
|
|
},
|
|
});
|
|
|
|
export default router;
|