fix(tagsView.ts): 固定tag位置置顶在前

Former-commit-id: 30c09d356d4f199b4f5f7587c8eec123ec7f5bb7
This commit is contained in:
郝先瑞
2022-05-22 00:17:22 +08:00
parent 4acf0cc371
commit 19b3a2c090

View File

@@ -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;