From 3b3fb80231f74eecfe2e98e9a7968bfc405bc37f Mon Sep 17 00:00:00 2001
From: LiuHao <liuhaoai545@gmail.com>
Date: 星期日, 18 六月 2023 23:47:10 +0800
Subject: [PATCH] add 新增路由跳转自定义title

---
 src/plugins/tab.ts |   18 ++++++++++++------
 1 files changed, 12 insertions(+), 6 deletions(-)

diff --git a/src/plugins/tab.ts b/src/plugins/tab.ts
index a310154..1c0ab7a 100644
--- a/src/plugins/tab.ts
+++ b/src/plugins/tab.ts
@@ -17,7 +17,7 @@
     }
     // prettier-ignore
     await useTagsViewStore().delCachedView(obj)
-    router.replace({
+    await router.replace({
       path: '/redirect' + obj.path,
       query: obj.query
     });
@@ -34,9 +34,9 @@
     if (obj === undefined) {
       // prettier-ignore
       const { visitedViews } = await useTagsViewStore().delView(router.currentRoute.value) as any
-      const latestView = visitedViews.slice(-1)[0]
+      const latestView = visitedViews.slice(-1)[0];
       if (latestView) {
-        return router.push(latestView.fullPath)
+        return router.push(latestView.fullPath);
       }
       return router.push('/');
     }
@@ -58,9 +58,15 @@
   closeOtherPage(obj: TagView) {
     return useTagsViewStore().delOthersViews(obj || router.currentRoute.value);
   },
-  // 鎵撳紑tab椤电
-  openPage(url: RouteLocationRaw) {
-    return router.push(url);
+  /**
+   * 鎵撳紑tab椤电
+   * @param url 璺敱鍦板潃
+   * @param title 鏍囬
+   * @param query 鍙傛暟
+   */
+  openPage(url: string, title?: string, query?: any) {
+    const obj = { path: url, query: { ...query, title } };
+    return router.push(obj);
   },
   // 淇敼tab椤电
   updatePage(obj: TagView) {

--
Gitblit v1.9.3