diff --git a/src/layout/components/tag/index.vue b/src/layout/components/tag/index.vue index dd95e4ffa..423ab901c 100644 --- a/src/layout/components/tag/index.vue +++ b/src/layout/components/tag/index.vue @@ -193,13 +193,13 @@ function deleteDynamicTag(obj: any, current: any, tag?: string) { ): void => { if (other) { useMultiTagsStoreHook().handleTags("equal", [routerArrays[0], obj]); - dynamicTagView(); } else { delAliveRouteList = useMultiTagsStoreHook().handleTags("splice", "", { startIndex, length }) as any; } + dynamicTagView(); }; if (tag === "other") { diff --git a/src/layout/hooks/useTag.ts b/src/layout/hooks/useTag.ts index aed9f5848..40fb1922b 100644 --- a/src/layout/hooks/useTag.ts +++ b/src/layout/hooks/useTag.ts @@ -12,10 +12,15 @@ import { tagsViewsType } from "../types"; import { useEventListener } from "@vueuse/core"; import { useRoute, useRouter } from "vue-router"; import { transformI18n, $t } from "@/plugins/i18n"; -import { isEqual, isBoolean } from "@pureadmin/utils"; import { useSettingStoreHook } from "@/store/modules/settings"; import { useMultiTagsStoreHook } from "@/store/modules/multiTags"; -import { storageLocal, toggleClass, hasClass } from "@pureadmin/utils"; +import { + isEqual, + isBoolean, + storageLocal, + toggleClass, + hasClass +} from "@pureadmin/utils"; import Fullscreen from "@iconify-icons/ri/fullscreen-fill"; import CloseAllTags from "@iconify-icons/ri/subtract-line"; diff --git a/src/router/index.ts b/src/router/index.ts index 25d7bf3b3..1650832a5 100644 --- a/src/router/index.ts +++ b/src/router/index.ts @@ -61,7 +61,7 @@ export const remainingPaths = Object.keys(remainingRouter).map(v => { /** 创建路由实例 */ export const router: Router = createRouter({ - history: getHistoryMode(), + history: getHistoryMode(import.meta.env.VITE_ROUTER_HISTORY), routes: constantRoutes.concat(...(remainingRouter as any)), strict: true, scrollBehavior(to, from, savedPosition) { diff --git a/src/router/utils.ts b/src/router/utils.ts index 68656e73f..d2a789803 100644 --- a/src/router/utils.ts +++ b/src/router/utils.ts @@ -322,8 +322,7 @@ function addAsyncRoutes(arrRoutes: Array) { } /** 获取路由历史模式 https://next.router.vuejs.org/zh/guide/essentials/history-mode.html */ -function getHistoryMode(): RouterHistory { - const routerHistory = import.meta.env.VITE_ROUTER_HISTORY; +function getHistoryMode(routerHistory): RouterHistory { // len为1 代表只有历史模式 为2 代表历史模式中存在base参数 https://next.router.vuejs.org/zh/api/#%E5%8F%82%E6%95%B0-1 const historyMode = routerHistory.split(","); const leftMode = historyMode[0]; diff --git a/src/store/modules/multiTags.ts b/src/store/modules/multiTags.ts index 5099e25a5..70f9f1f95 100644 --- a/src/store/modules/multiTags.ts +++ b/src/store/modules/multiTags.ts @@ -1,9 +1,8 @@ import { defineStore } from "pinia"; import { store } from "@/store"; -import { isEqual } from "@pureadmin/utils"; import { routerArrays } from "@/layout/types"; import { multiType, positionType } from "./types"; -import { isUrl, storageLocal } from "@pureadmin/utils"; +import { isEqual, isBoolean, isUrl, storageLocal } from "@pureadmin/utils"; export const useMultiTagsStore = defineStore({ id: "pure-multiTags", @@ -54,6 +53,9 @@ export const useMultiTagsStore = defineStore({ if (isUrl(tagVal?.name)) return; // 如果title为空拒绝添加空信息到标签页 if (tagVal?.meta?.title.length === 0) return; + // showLink:false 不添加到标签页 + if (isBoolean(tagVal?.meta?.showLink) && !tagVal?.meta?.showLink) + return; const tagPath = tagVal.path; // 判断tag是否已存在 const tagHasExits = this.multiTags.some(tag => {