完善404页面,非合法路由自动跳转404
This commit is contained in:
@@ -50,6 +50,15 @@ const router = createRouter({
|
||||
path:'/admin',
|
||||
name:'Admin',
|
||||
component: () => import('../views/admin/index.vue'),
|
||||
},
|
||||
{
|
||||
path:'/404',
|
||||
name:'NotFound',
|
||||
component: () => import('../views/404.vue'),
|
||||
},
|
||||
{
|
||||
path: '/:pathMatch(.*)',
|
||||
redirect: '/404'
|
||||
}
|
||||
]
|
||||
})
|
||||
|
9
src/views/404.vue
Normal file
9
src/views/404.vue
Normal file
@@ -0,0 +1,9 @@
|
||||
<template>
|
||||
<div id="app">
|
||||
<iframe src="../../public/404/404.html" scrolling="auto" frameborder="0" style="width: 100%;height: 100%;"></iframe>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<style>
|
||||
html,body,#app {height: 100%;}
|
||||
</style>
|
Reference in New Issue
Block a user