Handle undefined routes

This commit is contained in:
Laurent
2025-03-08 22:32:50 +01:00
parent 180b88fb2b
commit 7a6dccf667
3 changed files with 20 additions and 32 deletions

View File

@@ -13,12 +13,11 @@
.text-block { .text-block {
display: flex; display: flex;
flex-direction: column; flex-direction: column;
justify-content: center; justify-content: center;
align-items: center; align-items: center;
} /*justify-content: start;*/
.text-block {
justify-content: start;
word-break: break-word; word-break: break-word;
height: fit-content; height: fit-content;
@@ -27,6 +26,7 @@
background: rgb(239, 239, 239); background: rgb(239, 239, 239);
} }
@media screen and (max-width: 1501px) { @media screen and (max-width: 1501px) {
.text-block { .text-block {
padding: 5px 15px 5px 15px; padding: 5px 15px 5px 15px;

View File

@@ -1,38 +1,18 @@
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 AboutView from '../views/AboutView.vue' import AboutView from '../views/AboutView.vue'
import ErrorView from '../views/ErrorView.vue'
import CreateView from "../views/CreateView.vue"; import CreateView from "../views/CreateView.vue";
import JoinView from "../views/JoinView.vue"; import JoinView from "../views/JoinView.vue";
import ErrorView from '../views/ErrorView.vue';
const router = createRouter({ const router = createRouter({
history: createWebHistory(import.meta.env.BASE_URL), history: createWebHistory(import.meta.env.BASE_URL),
routes: [ routes: [
{ { path: '/', name: 'home', component: HomeView},
path: '/', { path: '/about', name: 'about', component: AboutView},
name: 'home', { path: '/create', name: 'create', component: CreateView},
component: HomeView, { path: '/join', name: 'join', component: JoinView},
}, { path: '/:pathMatch(.*)*', component: ErrorView }
{
path: '/about',
name: 'about',
component: AboutView,
},
{
path: '/error',
name: 'error',
component: ErrorView,
},
{
path: '/create',
name: 'create',
component: CreateView,
},
{
path: '/join',
name: 'join',
component: JoinView,
}
] ]
}) })

View File

@@ -1,14 +1,22 @@
<script setup lang="ts"> <script setup lang="ts">
import TextBlock from "@/components/TextBlock.vue";
</script> </script>
<template> <template>
<TextBlock>
<h1>Oopsie</h1> <h1>Oopsie</h1>
<p>Something went wrong</p> <p>Something went wrong</p>
</TextBlock>
</template> </template>
<style scoped> <style scoped>
.text-block {
border-left: solid 4px red;
width: 35%;
height: 35%;
}
</style> </style>