Portage du site sous vuejs #232
2 changed files with 31 additions and 12 deletions
|
@ -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
14
src/views/RuleView.vue
Normal 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>
|
Loading…
Reference in a new issue