Skip to content

Commit 676e442

Browse files
Merge pull request #94 from dsgler/feat/404
feat: add 404 page
2 parents 0e87996 + 875fdb5 commit 676e442

2 files changed

Lines changed: 25 additions & 1 deletion

File tree

src/router/index.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,10 @@ const router = createRouter({
1414
},
1515
...appRoutes,
1616
NO_PERMISSION,
17-
// DETAIL,
17+
{
18+
path: '/:pathMatch(.*)',
19+
component: import('@/views/notFound/index.vue'),
20+
},
1821
],
1922
scrollBehavior(_to, _from, savedPosition) {
2023
if (savedPosition) {

src/views/notFound/index.vue

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
<template>
2+
<a-result
3+
status="404"
4+
:subtitle="$t('Page not found.')"
5+
class="h-screen flex flex-col justify-center"
6+
>
7+
<template #extra>
8+
<a-space>
9+
<a-button type="primary" @click="router.replace('/')">
10+
返回主页
11+
</a-button>
12+
</a-space>
13+
</template>
14+
</a-result>
15+
</template>
16+
17+
<script setup lang="ts">
18+
import router from '@/router';
19+
</script>
20+
21+
<style scoped lang="less"></style>

0 commit comments

Comments
 (0)