From 19b3a2c090e59275b4dbd524681684092bd89ddf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=83=9D=E5=85=88=E7=91=9E?= <1490493387@qq.com> Date: Sun, 22 May 2022 00:17:22 +0800 Subject: [PATCH] =?UTF-8?q?fix(tagsView.ts):=20=E5=9B=BA=E5=AE=9Atag?= =?UTF-8?q?=E4=BD=8D=E7=BD=AE=E7=BD=AE=E9=A1=B6=E5=9C=A8=E5=89=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Former-commit-id: 30c09d356d4f199b4f5f7587c8eec123ec7f5bb7 --- src/store/modules/tagsView.ts | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a/src/store/modules/tagsView.ts b/src/store/modules/tagsView.ts index 76624558..45b60424 100644 --- a/src/store/modules/tagsView.ts +++ b/src/store/modules/tagsView.ts @@ -10,11 +10,19 @@ const useTagsViewStore = defineStore({ actions: { addVisitedView(view: any) { if (this.visitedViews.some(v => v.path === view.path)) return; - this.visitedViews.push( - Object.assign({}, view, { - title: view.meta?.title || 'no-name' - }) - ); + if (view.meta && view.meta.affix) { + this.visitedViews.unshift( + Object.assign({}, view, { + title: view.meta?.title || 'no-name' + }) + ); + } else { + this.visitedViews.push( + Object.assign({}, view, { + title: view.meta?.title || 'no-name' + }) + ); + } }, addCachedView(view: any) { if (this.cachedViews.includes(view.name)) return;