From 03080e12de7de3fec89b2f77fcf9f73c02bc6cf0 Mon Sep 17 00:00:00 2001 From: wujingjing <gersonwu@qq.com> Date: 星期三, 30 十月 2024 14:33:12 +0800 Subject: [PATCH] 获取相似问题,group_type --- src/utils/route.ts | 21 ++++++--------------- 1 files changed, 6 insertions(+), 15 deletions(-) diff --git a/src/utils/route.ts b/src/utils/route.ts index dec9169..baf54ff 100644 --- a/src/utils/route.ts +++ b/src/utils/route.ts @@ -9,25 +9,16 @@ /** * 鎸夎矾鐢卞悕绉拌烦杞嚦鎸囧畾璺敱 - * 璺敱宸茬紦瀛樻椂锛屼細娓呴櫎缂撳瓨 + * 鐪� meta 璁剧疆鐨勫弬鏁帮紝鍒ゆ柇鏄惁闇�瑕佽缃矾鐢辩紦瀛� * @param routeLocation 璺敱浣嶇疆锛屼笌 router.push 鍙傛暟涓�鑷� */ export const gotoRoute = (routeLocation: RouteLocationName) => { - const storesKeepAliveNames = useKeepALiveNames(); const routeName = routeLocation.name; - const { cachedViews } = storeToRefs(storesKeepAliveNames); - const isInclude = cachedViews.value.includes(routeName); - - if (isInclude) { - storesKeepAliveNames.delCachedView({ - name: routeName, - }); - } - router.push(routeLocation).then(() => { - if (isInclude) { - cachedViews.value.push(routeName); - } - }); + + const storesKeepAliveNames = useKeepALiveNames(); + const gotoRoute = router.getRoutes().find((item) => item.name === routeName); + storesKeepAliveNames.addCachedView(gotoRoute) + router.push(routeLocation); }; /** -- Gitblit v1.9.3