feat 优化标签
This commit is contained in:
@@ -37,7 +37,12 @@ export const useTagsViewStore = defineStore('tagsView', () => {
|
||||
});
|
||||
};
|
||||
const addVisitedView = (view: RouteLocationNormalized): void => {
|
||||
if (visitedViews.value.some((v: RouteLocationNormalized) => v.path === view.path)) return;
|
||||
// 同时通过 path、fullPath、name 去重
|
||||
if (visitedViews.value.some((v: RouteLocationNormalized) =>
|
||||
v.path === view.path ||
|
||||
v.fullPath === view.fullPath ||
|
||||
(v.name && view.name && v.name === view.name)
|
||||
)) return;
|
||||
visitedViews.value.push(
|
||||
Object.assign({}, view, {
|
||||
title: view.meta?.title || 'no-name'
|
||||
|
||||
Reference in New Issue
Block a user