implement not found for ui
All checks were successful
Cargo / build (push) Successful in 34s
Cargo / ui (push) Successful in 38s
Cargo / check (push) Successful in 37s
Cargo / test (push) Successful in 38s

This commit is contained in:
2025-07-19 01:29:32 +01:00
parent dfdcad7b1f
commit be6c1b5701
10 changed files with 86 additions and 6 deletions

View File

@ -13,7 +13,7 @@ import HelloWorld from './components/HelloWorld.vue'
<nav>
<RouterLink to="/">Home</RouterLink>
<RouterLink to="/about">About</RouterLink>
<RouterLink to="/test">Test</RouterLink>
<RouterLink to="/asdf">asdfasdf</RouterLink>
</nav>
</div>
</header>

View File

@ -1,5 +1,6 @@
import { createRouter, createWebHistory } from 'vue-router'
import HomeView from '../views/HomeView.vue'
import NotFoundView from '../views/NotFoundView.vue'
const router = createRouter({
history: createWebHistory(import.meta.env.BASE_URL),
@ -17,6 +18,11 @@ const router = createRouter({
// which is lazy-loaded when the route is visited.
component: () => import('../views/AboutView.vue'),
},
{
path: '/:path(.*)*',
name: 'not-found',
component: NotFoundView,
},
],
})

View File

@ -0,0 +1,16 @@
<script setup lang="ts">
import { useRoute } from 'vue-router'
const route = useRoute()
let path = "/"
for( let part of route.params.path ){
path += part + "/"
}
path = path.slice(0,-1)
</script>
<template>
<main>
Could not find page at {{ path }}
</main>
</template>