From ada4430ed5422dd86fde294d6debd24313ae257f Mon Sep 17 00:00:00 2001 From: white Date: Fri, 25 Apr 2025 09:54:11 +0800 Subject: [PATCH] =?UTF-8?q?=E9=A1=B6=E9=83=A8=E8=8F=9C=E5=8D=95=E6=90=9C?= =?UTF-8?q?=E7=B4=A2=E7=BB=93=E6=9E=9C=E4=B8=AD=E8=BF=9B=E8=A1=8C=E7=82=B9?= =?UTF-8?q?=E5=87=BB=E8=B7=B3=E8=BD=AC=E6=97=B6=E6=9C=AA=E6=90=BA=E5=B8=A6?= =?UTF-8?q?=E5=88=9B=E5=BB=BA=E8=8F=9C=E5=8D=95=E6=97=B6=E5=88=9B=E5=BB=BA?= =?UTF-8?q?=E7=9A=84=E9=A2=9D=E5=A4=96=E5=8F=82=E6=95=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/MenuSearch/index.vue | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/components/MenuSearch/index.vue b/src/components/MenuSearch/index.vue index 65bd7def..8e8e4d26 100644 --- a/src/components/MenuSearch/index.vue +++ b/src/components/MenuSearch/index.vue @@ -128,7 +128,7 @@ import { ref, computed, onMounted, onBeforeUnmount } from "vue"; import router from "@/router"; import { usePermissionStore } from "@/store"; import { isExternal } from "@/utils"; -import { RouteRecordRaw } from "vue-router"; +import { RouteRecordRaw, LocationQueryRaw } from "vue-router"; import { Clock, Close, Delete } from "@element-plus/icons-vue"; const HISTORY_KEY = "menu_search_history"; @@ -150,6 +150,7 @@ interface SearchItem { name?: string; icon?: string; redirect?: string; + params?: LocationQueryRaw; } // 从本地存储加载搜索历史 @@ -284,7 +285,7 @@ function navigateToRoute(item: SearchItem) { if (isExternal(item.path)) { window.open(item.path, "_blank"); } else { - router.push(item.path); + router.push({ path: item.path, query: item.params }); } } @@ -303,6 +304,7 @@ function loadRoutes(routes: RouteRecordRaw[], parentPath = "") { name: typeof route.name === "string" ? route.name : undefined, icon: route.meta.icon, redirect: typeof route.redirect === "string" ? route.redirect : undefined, + params: route.meta.params ? JSON.parse(JSON.stringify(toRaw(route.meta.params))) : undefined }); } }); -- Gitee