From facb09d7794129a62c60d5a5a16354c5ffc8f01f Mon Sep 17 00:00:00 2001 From: xiaoxian521 <1923740402@qq.com> Date: Wed, 16 Nov 2022 17:30:24 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E9=A1=B5=E5=86=85=E8=8F=9C=E5=8D=95?= =?UTF-8?q?=E5=B8=A6=E5=8F=82=E4=BA=92=E7=9B=B8=E8=B7=B3=E8=BD=AC=EF=BC=8C?= =?UTF-8?q?=E6=A0=87=E7=AD=BE=E6=B2=A1=E6=9C=89=E9=80=89=E4=B8=AD=E9=AB=98?= =?UTF-8?q?=E4=BA=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- mock/asyncRoutes.ts | 3 +++ src/layout/hooks/useTag.ts | 17 +++++++------- .../nested/menu1/menu1-2/menu1-2-2/index.vue | 6 +++++ src/views/tabs/index.vue | 22 +++++++++++++++++++ 4 files changed, 39 insertions(+), 9 deletions(-) diff --git a/mock/asyncRoutes.ts b/mock/asyncRoutes.ts index d245df747..937e275ac 100644 --- a/mock/asyncRoutes.ts +++ b/mock/asyncRoutes.ts @@ -137,6 +137,7 @@ const tabsRouter = { roles: ["admin", "common"] } }, + // query 传参模式 { path: "/tabs/query-detail", name: "TabQueryDetail", @@ -146,11 +147,13 @@ const tabsRouter = { roles: ["admin", "common"] } }, + // params 传参模式 { path: "/tabs/params-detail/:id", component: "params-detail", name: "TabParamsDetail", meta: { + // 不在menu菜单中显示 showLink: false, roles: ["admin", "common"] } diff --git a/src/layout/hooks/useTag.ts b/src/layout/hooks/useTag.ts index 8bc511838..84b72a845 100644 --- a/src/layout/hooks/useTag.ts +++ b/src/layout/hooks/useTag.ts @@ -9,11 +9,11 @@ import { getCurrentInstance } from "vue"; import { tagsViewsType } from "../types"; -import { isEqual } from "@pureadmin/utils"; import type { StorageConfigs } from "/#/index"; 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"; @@ -106,15 +106,14 @@ export function useTags() { ]); function conditionHandle(item, previous, next) { - if ( - Object.keys(route.query).length === 0 && - Object.keys(route.params).length === 0 - ) { - return route.path === item.path ? previous : next; - } else if (Object.keys(route.query).length > 0) { - return isEqual(route.query, item.query) ? previous : next; + if (isBoolean(route?.meta?.showLink) && route?.meta?.showLink === false) { + if (Object.keys(route.query).length > 0) { + return isEqual(route.query, item.query) ? previous : next; + } else { + return isEqual(route.params, item.params) ? previous : next; + } } else { - return isEqual(route.params, item.params) ? previous : next; + return route.path === item.path ? previous : next; } } diff --git a/src/views/nested/menu1/menu1-2/menu1-2-2/index.vue b/src/views/nested/menu1/menu1-2/menu1-2-2/index.vue index f60713c87..44df309d9 100644 --- a/src/views/nested/menu1/menu1-2/menu1-2-2/index.vue +++ b/src/views/nested/menu1/menu1-2/menu1-2-2/index.vue @@ -1,6 +1,7 @@ diff --git a/src/views/tabs/index.vue b/src/views/tabs/index.vue index 0cb50dcb2..698ccd0e5 100644 --- a/src/views/tabs/index.vue +++ b/src/views/tabs/index.vue @@ -117,6 +117,28 @@ function onCloseTags() { > 跳转页内菜单(传path对象) + + + + 携参跳转页内菜单(传name对象,优先推荐) + + + 携参跳转页内菜单(传path对象) +