feat: 添加全屏403404500页面,全屏错误页面清晰且安全,提升用户体验 (#1226)

This commit is contained in:
xiaoming
2025-09-18 10:05:14 +08:00
committed by GitHub
parent 915e01c15c
commit faf24f300b
8 changed files with 90 additions and 42 deletions

View File

@@ -139,16 +139,6 @@ function findRouteByPath(path: string, routes: RouteRecordRaw[]) {
}
}
function addPathMatch() {
if (!router.hasRoute("pathMatch")) {
router.addRoute({
path: "/:pathMatch(.*)",
name: "pathMatch",
redirect: "/error/404"
});
}
}
/** 处理动态路由(后端返回的路由) */
function handleAsyncRoutes(routeList) {
if (routeList.length === 0) {
@@ -188,7 +178,6 @@ function handleAsyncRoutes(routeList) {
)
]);
}
addPathMatch();
}
/** 初始化路由(`new Promise` 写法防止在异步请求中造成无限循环)*/
@@ -397,7 +386,6 @@ export {
filterTree,
initRouter,
getTopMenu,
addPathMatch,
isOneOfArray,
getHistoryMode,
addAsyncRoutes,