fix: 🐛 修改tagsview刷新丢失query问题

修复url携带query时,顶部tagsview点击丢失问题
This commit is contained in:
andm31
2024-05-23 10:38:38 +08:00
parent fb48aad4be
commit 7f4be6649b

View File

@@ -162,6 +162,7 @@ function addTags() {
fullPath: route.fullPath, fullPath: route.fullPath,
affix: route.meta?.affix, affix: route.meta?.affix,
keepAlive: route.meta?.keepAlive, keepAlive: route.meta?.keepAlive,
query: route.query,
}); });
} }
} }
@@ -181,6 +182,7 @@ function moveToCurrentTag() {
fullPath: route.fullPath, fullPath: route.fullPath,
affix: route.meta?.affix, affix: route.meta?.affix,
keepAlive: route.meta?.keepAlive, keepAlive: route.meta?.keepAlive,
query: route.query,
}); });
} }
} }
@@ -222,7 +224,7 @@ function refreshSelectedTag(view: TagView) {
tagsViewStore.delCachedView(view); tagsViewStore.delCachedView(view);
const { fullPath } = view; const { fullPath } = view;
nextTick(() => { nextTick(() => {
router.replace({ path: "/redirect" + fullPath }); router.replace("/redirect" + fullPath);
}); });
} }
@@ -235,7 +237,7 @@ function toLastView(visitedViews: TagView[], view?: TagView) {
// you can adjust it according to your needs. // you can adjust it according to your needs.
if (view?.name === "Dashboard") { if (view?.name === "Dashboard") {
// to reload home page // to reload home page
router.replace({ path: "/redirect" + view.fullPath }); router.replace("/redirect" + view.fullPath);
} else { } else {
router.push("/"); router.push("/");
} }