80 lines
1.9 KiB
TypeScript
80 lines
1.9 KiB
TypeScript
import type { AppRouteRecordRaw } from '/@/router/types';
|
||
import { t } from '/@/hooks/web/useI18n';
|
||
import { REDIRECT_NAME, LAYOUT, EXCEPTION_COMPONENT, PAGE_NOT_FOUND_NAME } from '/@/router/constant';
|
||
|
||
/**
|
||
* 全局 404 路由。
|
||
*
|
||
* 说明:vue-router ≥4.4 要求嵌套路由名全局唯一,且子路由不能与祖先同名。
|
||
* 因此父路由用 PageNotFoundParent,子路由保留 PAGE_NOT_FOUND_NAME(PageNotFound),
|
||
* 避免启动时 Uncaught Error 导致白屏一直转圈。
|
||
*/
|
||
export const PAGE_NOT_FOUND_ROUTE: AppRouteRecordRaw = {
|
||
path: '/:path(.*)*',
|
||
name: `${PAGE_NOT_FOUND_NAME}Parent`,
|
||
component: LAYOUT,
|
||
meta: {
|
||
title: 'ErrorPage',
|
||
hideBreadcrumb: true,
|
||
hideMenu: true,
|
||
},
|
||
children: [
|
||
{
|
||
path: '/:path(.*)*',
|
||
name: PAGE_NOT_FOUND_NAME,
|
||
component: EXCEPTION_COMPONENT,
|
||
meta: {
|
||
title: 'ErrorPage',
|
||
hideBreadcrumb: true,
|
||
hideMenu: true,
|
||
},
|
||
},
|
||
],
|
||
};
|
||
|
||
export const REDIRECT_ROUTE: AppRouteRecordRaw = {
|
||
path: '/redirect',
|
||
component: LAYOUT,
|
||
name: 'RedirectTo',
|
||
meta: {
|
||
title: REDIRECT_NAME,
|
||
hideBreadcrumb: true,
|
||
hideMenu: true,
|
||
},
|
||
children: [
|
||
{
|
||
path: '/redirect/:path(.*)',
|
||
name: REDIRECT_NAME,
|
||
component: () => import('/@/views/sys/redirect/index.vue'),
|
||
meta: {
|
||
title: REDIRECT_NAME,
|
||
hideBreadcrumb: true,
|
||
},
|
||
},
|
||
],
|
||
};
|
||
|
||
export const ERROR_LOG_ROUTE: AppRouteRecordRaw = {
|
||
path: '/error-log',
|
||
name: 'ErrorLog',
|
||
component: LAYOUT,
|
||
redirect: '/error-log/list',
|
||
meta: {
|
||
title: 'ErrorLog',
|
||
hideBreadcrumb: true,
|
||
hideChildrenInMenu: true,
|
||
},
|
||
children: [
|
||
{
|
||
path: 'list',
|
||
name: 'ErrorLogList',
|
||
component: () => import('/@/views/sys/error-log/index.vue'),
|
||
meta: {
|
||
title: t('routes.basic.errorLogList'),
|
||
hideBreadcrumb: true,
|
||
currentActiveMenu: '/error-log',
|
||
},
|
||
},
|
||
],
|
||
};
|