mirror of
https://github.com/XiaoDaiGua-Ray/ray-template.git
synced 2025-05-30 17:49:20 +08:00
补充错误路由重定向错误页
This commit is contained in:
parent
54d025282b
commit
be48cf914c
@ -6,6 +6,7 @@ import {
|
||||
NConfigProvider,
|
||||
createDiscreteApi,
|
||||
darkTheme,
|
||||
NGlobalStyle,
|
||||
} from 'naive-ui'
|
||||
import { useSetting } from '@/store'
|
||||
|
||||
@ -24,9 +25,9 @@ const GlobalProvider = defineComponent({
|
||||
const { message, notification, dialog, loadingBar } = createDiscreteApi(
|
||||
['message', 'dialog', 'notification', 'loadingBar'],
|
||||
{
|
||||
configProviderProps: {
|
||||
configProviderProps: computed(() => ({
|
||||
theme: modelThemeValue.value,
|
||||
},
|
||||
})),
|
||||
},
|
||||
)
|
||||
|
||||
@ -50,6 +51,7 @@ const GlobalProvider = defineComponent({
|
||||
<NMessageProvider>
|
||||
<NDialogProvider>
|
||||
<NNotificationProvider>
|
||||
<NGlobalStyle />
|
||||
{this.$slots.default?.()}
|
||||
</NNotificationProvider>
|
||||
</NDialogProvider>
|
||||
|
@ -14,6 +14,11 @@ export const constantRoutes = [
|
||||
component: Layout,
|
||||
children: childrenRoutes,
|
||||
},
|
||||
{
|
||||
path: '/:catchAll(.*)',
|
||||
name: 'error-page',
|
||||
component: () => import('@/views/error/index'),
|
||||
},
|
||||
]
|
||||
|
||||
/**
|
||||
|
5
src/views/error/index.scss
Normal file
5
src/views/error/index.scss
Normal file
@ -0,0 +1,5 @@
|
||||
.error-page {
|
||||
width: 100%;
|
||||
height: 100vh;
|
||||
@include flexCenter;
|
||||
}
|
32
src/views/error/index.tsx
Normal file
32
src/views/error/index.tsx
Normal file
@ -0,0 +1,32 @@
|
||||
import './index.scss'
|
||||
import { NResult, NButton } from 'naive-ui'
|
||||
|
||||
const ErrorPage = defineComponent({
|
||||
name: 'ErrorPage',
|
||||
setup() {
|
||||
const router = useRouter()
|
||||
|
||||
const handleBack = () => {
|
||||
router.push('/dashboard')
|
||||
}
|
||||
|
||||
return {
|
||||
handleBack,
|
||||
}
|
||||
},
|
||||
render() {
|
||||
return (
|
||||
<div class="error-page">
|
||||
<NResult status="500" title="小调皮你走错地方了">
|
||||
{{
|
||||
footer: () => (
|
||||
<NButton onClick={this.handleBack.bind(this)}>返回首页</NButton>
|
||||
),
|
||||
}}
|
||||
</NResult>
|
||||
</div>
|
||||
)
|
||||
},
|
||||
})
|
||||
|
||||
export default ErrorPage
|
@ -3,11 +3,6 @@
|
||||
flex-direction: column;
|
||||
font-size: 36px;
|
||||
|
||||
&.login--dark {
|
||||
background-color: #101014;
|
||||
color: #ffffff;
|
||||
}
|
||||
|
||||
& .login-title {
|
||||
padding: 18px 0;
|
||||
}
|
||||
|
@ -35,10 +35,7 @@ const Login = defineComponent({
|
||||
},
|
||||
render() {
|
||||
return (
|
||||
<div
|
||||
class={['login', this.themeValue ? 'login--dark' : '']}
|
||||
style={[`height: ${this.windowHeight}px`]}
|
||||
>
|
||||
<div class={['login']} style={[`height: ${this.windowHeight}px`]}>
|
||||
<NSpace>
|
||||
<NGradientText class="login-title" type="info">
|
||||
Ray Template
|
||||
|
Loading…
x
Reference in New Issue
Block a user