Template
1
0
mirror of https://github.com/un-pany/v3-admin-vite.git synced 2025-04-22 03:49:19 +08:00

Update tags-view.ts

This commit is contained in:
pany 2024-11-08 19:37:39 +08:00 committed by GitHub
parent 6df0470836
commit 4922fb8474
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -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 })
}
}