mirror of
https://github.com/pure-admin/pure-admin-thin.git
synced 2025-11-26 04:23:40 +08:00
index on main: f96885b perf: 同步代码
This commit is contained in:
@@ -5,12 +5,12 @@ import {
|
||||
createWebHashHistory,
|
||||
RouteRecordNormalized
|
||||
} from "vue-router";
|
||||
import { RouteConfigs } from "/@/layout/types";
|
||||
import { split, uniqBy } from "lodash-es";
|
||||
import { i18n } from "/@/plugins/i18n";
|
||||
import { openLink } from "/@/utils/link";
|
||||
import NProgress from "/@/utils/progress";
|
||||
import { useTimeoutFn } from "@vueuse/core";
|
||||
import { RouteConfigs } from "/@/layout/types";
|
||||
import { storageSession, storageLocal } from "/@/utils/storage";
|
||||
import { usePermissionStoreHook } from "/@/store/modules/permission";
|
||||
|
||||
@@ -18,6 +18,7 @@ import { usePermissionStoreHook } from "/@/store/modules/permission";
|
||||
import homeRouter from "./modules/home";
|
||||
import Layout from "/@/layout/index.vue";
|
||||
import errorRouter from "./modules/error";
|
||||
import externalLink from "./modules/externalLink";
|
||||
import remainingRouter from "./modules/remaining";
|
||||
// 动态路由
|
||||
import { getAsyncRoutes } from "/@/api/routes";
|
||||
@@ -25,7 +26,11 @@ import { getAsyncRoutes } from "/@/api/routes";
|
||||
// https://cn.vitejs.dev/guide/features.html#glob-import
|
||||
const modulesRoutes = import.meta.glob("/src/views/*/*/*.vue");
|
||||
|
||||
const constantRoutes: Array<RouteComponent> = [homeRouter, errorRouter];
|
||||
const constantRoutes: Array<RouteComponent> = [
|
||||
homeRouter,
|
||||
externalLink,
|
||||
errorRouter
|
||||
];
|
||||
|
||||
// 按照路由中meta下的rank等级升序来排序路由
|
||||
export const ascending = arr => {
|
||||
@@ -181,7 +186,7 @@ export function resetRouter() {
|
||||
}
|
||||
|
||||
// 路由白名单
|
||||
const whiteList = ["/login", "/register"];
|
||||
const whiteList = ["/login"];
|
||||
|
||||
router.beforeEach((to, _from, next) => {
|
||||
if (to.meta?.keepAlive) {
|
||||
|
||||
@@ -6,7 +6,7 @@ const errorRouter = {
|
||||
component: Layout,
|
||||
redirect: "/error/401",
|
||||
meta: {
|
||||
icon: "el-icon-position",
|
||||
icon: "Position",
|
||||
title: "message.hserror",
|
||||
showLink: true,
|
||||
rank: 7
|
||||
|
||||
25
src/router/modules/externalLink.ts
Normal file
25
src/router/modules/externalLink.ts
Normal file
@@ -0,0 +1,25 @@
|
||||
import Layout from "/@/layout/index.vue";
|
||||
|
||||
const externalLink = {
|
||||
path: "/external",
|
||||
name: "external",
|
||||
component: Layout,
|
||||
meta: {
|
||||
icon: "Link",
|
||||
title: "message.externalLink",
|
||||
showLink: true,
|
||||
rank: 190
|
||||
},
|
||||
children: [
|
||||
{
|
||||
path: "https://github.com/xiaoxian521/vue-pure-admin",
|
||||
meta: {
|
||||
title: "message.externalLink",
|
||||
showLink: true,
|
||||
rank: 191
|
||||
}
|
||||
}
|
||||
]
|
||||
};
|
||||
|
||||
export default externalLink;
|
||||
@@ -6,7 +6,7 @@ const homeRouter = {
|
||||
component: Layout,
|
||||
redirect: "/welcome",
|
||||
meta: {
|
||||
icon: "el-icon-s-home",
|
||||
icon: "HomeFilled",
|
||||
showLink: true,
|
||||
rank: 0
|
||||
},
|
||||
|
||||
@@ -11,22 +11,12 @@ const remainingRouter = [
|
||||
rank: 101
|
||||
}
|
||||
},
|
||||
{
|
||||
path: "/register",
|
||||
name: "register",
|
||||
component: () => import("/@/views/register.vue"),
|
||||
meta: {
|
||||
title: "message.hsregister",
|
||||
showLink: false,
|
||||
rank: 102
|
||||
}
|
||||
},
|
||||
{
|
||||
path: "/redirect",
|
||||
name: "redirect",
|
||||
component: Layout,
|
||||
meta: {
|
||||
icon: "el-icon-s-home",
|
||||
icon: "HomeFilled",
|
||||
title: "message.hshome",
|
||||
showLink: false,
|
||||
rank: 104
|
||||
|
||||
Reference in New Issue
Block a user