feat: ajout des pages de règles

This commit is contained in:
Kazhnuz 2023-02-03 21:40:22 +01:00
parent fd731c447d
commit 87dbce765e
2 changed files with 31 additions and 12 deletions

View file

@ -1,23 +1,28 @@
import { createRouter, createWebHistory } from 'vue-router' import { createRouter, createWebHistory } from "vue-router";
import HomeView from '../views/HomeView.vue' import HomeView from "../views/HomeView.vue";
import RuleView from "../views/RuleView.vue";
const router = createRouter({ const router = createRouter({
history: createWebHistory(import.meta.env.BASE_URL), history: createWebHistory(import.meta.env.BASE_URL),
routes: [ routes: [
{ {
path: '/', path: "/",
name: 'home', name: "home",
component: HomeView component: HomeView,
}, },
{ {
path: '/about', path: "/jdr/:jdr/rules/:category/:filepath",
name: 'about', component: RuleView,
},
{
path: "/about",
name: "about",
// route level code-splitting // route level code-splitting
// this generates a separate chunk (About.[hash].js) for this route // this generates a separate chunk (About.[hash].js) for this route
// which is lazy-loaded when the route is visited. // which is lazy-loaded when the route is visited.
component: () => import('../views/AboutView.vue') component: () => import("../views/AboutView.vue"),
} },
] ],
}) });
export default router export default router;

14
src/views/RuleView.vue Normal file
View file

@ -0,0 +1,14 @@
<script setup lang="ts">
import MarkdownFile from "../components/MarkdownFile.vue";
import { useRoute } from "vue-router";
const route = useRoute();
const category = route.params.category;
const filepath = route.params.filepath;
</script>
<template>
<main>
<MarkdownFile :path="`rules/${category}/${filepath}`" />
</main>
</template>