fix(路由): 清除URL中的token参数并保留其他查询参数

当URL中包含token参数时,自动清除该参数并保留其他查询参数,防止token暴露在URL中
This commit is contained in:
zzp 2025-11-08 17:53:00 +08:00
parent d25f87a889
commit 3ab1dfae30
1 changed files with 10 additions and 0 deletions

View File

@ -149,6 +149,16 @@ onMounted(async (e) => {
Session.set("token", res.data.token); Session.set("token", res.data.token);
Session.set("userPhone", res.data.phone); Session.set("userPhone", res.data.phone);
// token
const { token, ...otherQuery } = route.query;
// token
if (token) {
router.replace({
path: route.path, //
query: otherQuery, //
});
}
setTimeout(() => { setTimeout(() => {
window.location.reload(); window.location.reload();
}, 500); }, 500);