document new route

This commit is contained in:
isUnknown 2024-09-17 18:11:42 +02:00
parent 36146497ec
commit 463428f14c
4 changed files with 65 additions and 55 deletions

View file

@ -1,36 +1,9 @@
import { createWebHistory, createRouter } from "vue-router";
import Home from "../views/Home.vue";
import Notifications from "../views/Notifications.vue";
import Reunions from "../views/Reunions.vue";
import Inspirations from "../views/Inspirations.vue";
import Project from "../views/Project.vue";
import routes from "./routes";
import { useApiStore } from "../stores/api";
import { usePageStore } from "../stores/page";
import { getActivePinia } from "pinia";
const routes = [
{
path: "/",
component: Home,
},
{
path: "/notifications",
component: Notifications,
},
{
path: "/reunions",
component: Reunions,
},
{
path: "/inspirations",
component: Inspirations,
},
{
path: "/projects/:id",
component: Project,
},
];
const router = createRouter({
history: createWebHistory(),
routes,

30
src/router/routes.js Normal file
View file

@ -0,0 +1,30 @@
import Home from "../views/Home.vue";
import Notifications from "../views/Notifications.vue";
import Reunions from "../views/Reunions.vue";
import Inspirations from "../views/Inspirations.vue";
import Project from "../views/Project.vue";
const routes = [
{
path: "/",
component: Home,
},
{
path: "/notifications",
component: Notifications,
},
{
path: "/reunions",
component: Reunions,
},
{
path: "/inspirations",
component: Inspirations,
},
{
path: "/projects/:id",
component: Project,
},
];
export default routes;

View file

@ -1,16 +1,12 @@
<template>
<h1>{{ data.content.title }}</h1>
<!-- ... -->
<h1>{{ page.content.title }}</h1>
</template>
<style scoped>
</style>
<script setup>
const { data } = defineProps({
data: Object,
});
import { usePageStore } from "../stores/page";
import { storeToRefs } from "pinia";
// ....
const { page } = storeToRefs(usePageStore());
</script>
<style scoped></style>