mirror of
https://github.com/pure-admin/pure-admin-thin.git
synced 2025-11-26 04:23:40 +08:00
release: update 2.8.0
This commit is contained in:
@@ -117,8 +117,9 @@ router.beforeEach((to: toRouteType, _from, next) => {
|
||||
route?.meta?.rank !== 0 &&
|
||||
routePartent.length === 0
|
||||
) {
|
||||
if (!route?.meta?.refreshRedirect) return;
|
||||
const { name, meta } = findRouteByPath(
|
||||
route?.meta?.refreshRedirect,
|
||||
route.meta.refreshRedirect,
|
||||
routes
|
||||
);
|
||||
handTag(
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
import { $t } from "/@/plugins/i18n";
|
||||
import Layout from "/@/layout/index.vue";
|
||||
|
||||
const errorRouter = {
|
||||
@@ -7,7 +8,7 @@ const errorRouter = {
|
||||
redirect: "/error/401",
|
||||
meta: {
|
||||
icon: "Position",
|
||||
title: "message.hserror",
|
||||
title: $t("menus.hserror"),
|
||||
showLink: true,
|
||||
i18n: true,
|
||||
rank: 7
|
||||
@@ -18,7 +19,7 @@ const errorRouter = {
|
||||
name: "401",
|
||||
component: () => import("/@/views/error/401.vue"),
|
||||
meta: {
|
||||
title: "message.hsfourZeroOne",
|
||||
title: $t("menus.hsfourZeroOne"),
|
||||
i18n: true,
|
||||
showLink: true
|
||||
}
|
||||
@@ -28,7 +29,7 @@ const errorRouter = {
|
||||
name: "404",
|
||||
component: () => import("/@/views/error/404.vue"),
|
||||
meta: {
|
||||
title: "message.hsfourZeroFour",
|
||||
title: $t("menus.hsfourZeroFour"),
|
||||
i18n: true,
|
||||
showLink: true
|
||||
}
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
import { $t } from "/@/plugins/i18n";
|
||||
import Layout from "/@/layout/index.vue";
|
||||
|
||||
const externalLink = {
|
||||
@@ -6,7 +7,7 @@ const externalLink = {
|
||||
component: Layout,
|
||||
meta: {
|
||||
icon: "Link",
|
||||
title: "message.externalLink",
|
||||
title: $t("menus.externalLink"),
|
||||
showLink: true,
|
||||
i18n: true,
|
||||
rank: 190
|
||||
@@ -15,7 +16,7 @@ const externalLink = {
|
||||
{
|
||||
path: "https://github.com/xiaoxian521/vue-pure-admin",
|
||||
meta: {
|
||||
title: "message.externalLink",
|
||||
title: $t("menus.externalLink"),
|
||||
showLink: true,
|
||||
i18n: true,
|
||||
rank: 191
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
import { $t } from "/@/plugins/i18n";
|
||||
import Layout from "/@/layout/index.vue";
|
||||
|
||||
const homeRouter = {
|
||||
@@ -7,6 +8,7 @@ const homeRouter = {
|
||||
redirect: "/welcome",
|
||||
meta: {
|
||||
icon: "HomeFilled",
|
||||
title: $t("menus.hshome"),
|
||||
showLink: true,
|
||||
i18n: true,
|
||||
rank: 0
|
||||
@@ -17,7 +19,7 @@ const homeRouter = {
|
||||
name: "welcome",
|
||||
component: () => import("/@/views/welcome.vue"),
|
||||
meta: {
|
||||
title: "message.hshome",
|
||||
title: $t("menus.hshome"),
|
||||
i18n: true,
|
||||
showLink: true
|
||||
}
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
import { $t } from "/@/plugins/i18n";
|
||||
import Layout from "/@/layout/index.vue";
|
||||
|
||||
const remainingRouter = [
|
||||
@@ -6,7 +7,7 @@ const remainingRouter = [
|
||||
name: "login",
|
||||
component: () => import("/@/views/login.vue"),
|
||||
meta: {
|
||||
title: "message.hslogin",
|
||||
title: $t("menus.hslogin"),
|
||||
showLink: false,
|
||||
i18n: true,
|
||||
rank: 101
|
||||
@@ -18,7 +19,7 @@ const remainingRouter = [
|
||||
component: Layout,
|
||||
meta: {
|
||||
icon: "HomeFilled",
|
||||
title: "message.hshome",
|
||||
title: $t("menus.hshome"),
|
||||
i18n: true,
|
||||
showLink: false,
|
||||
rank: 104
|
||||
|
||||
@@ -13,7 +13,7 @@ import { useTimeoutFn } from "@vueuse/core";
|
||||
import { RouteConfigs } from "/@/layout/types";
|
||||
import { usePermissionStoreHook } from "/@/store/modules/permission";
|
||||
// https://cn.vitejs.dev/guide/features.html#glob-import
|
||||
const modulesRoutes = import.meta.glob("/src/views/*/*/*.vue");
|
||||
const modulesRoutes = import.meta.glob("/src/views/**/*.{vue,tsx}");
|
||||
|
||||
// 动态路由
|
||||
import { getAsyncRoutes } from "/@/api/routes";
|
||||
@@ -212,11 +212,13 @@ const handleAliveRoute = (matched: RouteRecordNormalized[], mode?: string) => {
|
||||
// 过滤后端传来的动态路由 重新生成规范路由
|
||||
const addAsyncRoutes = (arrRoutes: Array<RouteRecordRaw>) => {
|
||||
if (!arrRoutes || !arrRoutes.length) return;
|
||||
const modulesRoutesKeys = Object.keys(modulesRoutes);
|
||||
arrRoutes.forEach((v: RouteRecordRaw) => {
|
||||
if (v.redirect) {
|
||||
v.component = Layout;
|
||||
} else {
|
||||
v.component = modulesRoutes[`/src/views${v.path}/index.vue`];
|
||||
const index = modulesRoutesKeys.findIndex(ev => ev.includes(v.path));
|
||||
v.component = modulesRoutes[modulesRoutesKeys[index]];
|
||||
}
|
||||
if (v.children) {
|
||||
addAsyncRoutes(v.children);
|
||||
|
||||
Reference in New Issue
Block a user