From 4922fb84747741c5f6826192c07cc1ba90765ab2 Mon Sep 17 00:00:00 2001 From: pany <939630029@qq.com> Date: Fri, 8 Nov 2024 19:37:39 +0800 Subject: [PATCH] Update tags-view.ts --- src/store/modules/tags-view.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/store/modules/tags-view.ts b/src/store/modules/tags-view.ts index 51194de8..db728d3b 100644 --- a/src/store/modules/tags-view.ts +++ b/src/store/modules/tags-view.ts @@ -18,7 +18,7 @@ export const useTagsViewStore = defineStore("tags-view", () => { }) //#region add - const addVisitedView = (view: TagView) => { + const addVisitedView = (view: TagView, isUnshift: boolean = false) => { // 检查是否已经存在相同的 visitedView const index = visitedViews.value.findIndex((v) => v.path === view.path) if (index !== -1) { @@ -26,7 +26,7 @@ export const useTagsViewStore = defineStore("tags-view", () => { visitedViews.value[index].fullPath !== view.fullPath && (visitedViews.value[index] = { ...view }) } else { // 添加新的 visitedView - visitedViews.value.push({ ...view }) + isUnshift ? visitedViews.value.unshift({ ...view }) : visitedViews.value.push({ ...view }) } }