From ccbe849103c9626d20d998805386349fd61f4e40 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=96=AF=E7=8B=82=E7=9A=84=E7=8B=AE=E5=AD=90li?= <15040126243@163.com> Date: Thu, 6 Apr 2023 11:14:23 +0800 Subject: [PATCH] =?UTF-8?q?update=20=E5=85=B3=E9=97=AD=E9=A1=B5=E7=AD=BE?= =?UTF-8?q?=E5=90=8E=E5=AD=98=E5=9C=A8=E5=85=B6=E4=BB=96=E9=A1=B5=E7=AD=BE?= =?UTF-8?q?=E6=97=B6=E4=B8=8D=E5=BA=94=E8=AF=A5=E8=B7=B3=E8=BD=AC=E9=A6=96?= =?UTF-8?q?=E9=A1=B5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/plugins/tab.ts | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/plugins/tab.ts b/src/plugins/tab.ts index bc4128c..a310154 100644 --- a/src/plugins/tab.ts +++ b/src/plugins/tab.ts @@ -33,8 +33,12 @@ export default { async closePage(obj?: TagView): Promise<{ visitedViews: TagView[]; cachedViews: string[] } | any> { if (obj === undefined) { // prettier-ignore - const { lastPath } = await useTagsViewStore().delView(router.currentRoute.value) as any - return router.push(lastPath || '/index'); + const { visitedViews } = await useTagsViewStore().delView(router.currentRoute.value) as any + const latestView = visitedViews.slice(-1)[0] + if (latestView) { + return router.push(latestView.fullPath) + } + return router.push('/'); } return useTagsViewStore().delView(obj); },