Merge branch 'main' into pages

This commit is contained in:
xiaoxian521 2025-09-19 14:37:16 +08:00
commit 07785fe989
2 changed files with 23 additions and 23 deletions

View File

@ -8,8 +8,7 @@ export default [
component: () => import("@/views/login/index.vue"), component: () => import("@/views/login/index.vue"),
meta: { meta: {
title: $t("menus.pureLogin"), title: $t("menus.pureLogin"),
showLink: false, showLink: false
rank: 101
} }
}, },
// 全屏403无权访问页面 // 全屏403无权访问页面
@ -19,19 +18,7 @@ export default [
component: () => import("@/views/error/403.vue"), component: () => import("@/views/error/403.vue"),
meta: { meta: {
title: $t("menus.pureAccessDenied"), title: $t("menus.pureAccessDenied"),
showLink: false, showLink: false
rank: 102
}
},
// 全屏404页面不存在页面
{
path: "/:pathMatch(.*)*",
name: "PageNotFound",
component: () => import("@/views/error/404.vue"),
meta: {
title: $t("menus.purePageNotFound"),
showLink: false,
rank: 103
} }
}, },
// 全屏500服务器出错页面 // 全屏500服务器出错页面
@ -41,8 +28,7 @@ export default [
component: () => import("@/views/error/500.vue"), component: () => import("@/views/error/500.vue"),
meta: { meta: {
title: $t("menus.pureServerError"), title: $t("menus.pureServerError"),
showLink: false, showLink: false
rank: 104
} }
}, },
{ {
@ -50,8 +36,7 @@ export default [
component: Layout, component: Layout,
meta: { meta: {
title: $t("status.pureLoad"), title: $t("status.pureLoad"),
showLink: false, showLink: false
rank: 105
}, },
children: [ children: [
{ {
@ -67,8 +52,7 @@ export default [
component: () => import("@/views/account-settings/index.vue"), component: () => import("@/views/account-settings/index.vue"),
meta: { meta: {
title: $t("buttons.pureAccountSettings"), title: $t("buttons.pureAccountSettings"),
showLink: false, showLink: false
rank: 106
} }
}, },
// 下面是一个无layout菜单的例子一个全屏空白页面因为这种情况极少发生所以只需要在前端配置即可配置路径src/router/modules/remaining.ts // 下面是一个无layout菜单的例子一个全屏空白页面因为这种情况极少发生所以只需要在前端配置即可配置路径src/router/modules/remaining.ts
@ -78,8 +62,7 @@ export default [
component: () => import("@/views/empty/index.vue"), component: () => import("@/views/empty/index.vue"),
meta: { meta: {
title: $t("menus.pureEmpty"), title: $t("menus.pureEmpty"),
showLink: false, showLink: false
rank: 107
} }
} }
] satisfies Array<RouteConfigsTable>; ] satisfies Array<RouteConfigsTable>;

View File

@ -139,6 +139,21 @@ function findRouteByPath(path: string, routes: RouteRecordRaw[]) {
} }
} }
/** 动态路由注册完成后再添加全屏404页面不存在页面避免刷新动态路由页面时误跳转到404页面 */
function addPathMatch() {
if (!router.hasRoute("pathMatch")) {
router.addRoute({
path: "/:pathMatch(.*)*",
name: "PageNotFound",
component: () => import("@/views/error/404.vue"),
meta: {
title: "menus.purePageNotFound",
showLink: false
}
});
}
}
/** 处理动态路由(后端返回的路由) */ /** 处理动态路由(后端返回的路由) */
function handleAsyncRoutes(routeList) { function handleAsyncRoutes(routeList) {
if (routeList.length === 0) { if (routeList.length === 0) {
@ -178,6 +193,7 @@ function handleAsyncRoutes(routeList) {
) )
]); ]);
} }
addPathMatch();
} }
/** 初始化路由(`new Promise` 写法防止在异步请求中造成无限循环)*/ /** 初始化路由(`new Promise` 写法防止在异步请求中造成无限循环)*/
@ -386,6 +402,7 @@ export {
filterTree, filterTree,
initRouter, initRouter,
getTopMenu, getTopMenu,
addPathMatch,
isOneOfArray, isOneOfArray,
getHistoryMode, getHistoryMode,
addAsyncRoutes, addAsyncRoutes,