🐛 路由跳转优化

This commit is contained in:
BTMuli
2023-09-23 20:58:10 +08:00
parent b727688e9c
commit de810278bd
3 changed files with 9 additions and 3 deletions

View File

@@ -125,7 +125,6 @@ async function getDeepLink(): Promise<void> {
} else { } else {
await router.push("/achievements/?app=" + appName); await router.push("/achievements/?app=" + appName);
} }
window.location.reload();
} else { } else {
showSnackbar({ showSnackbar({
text: "无效的 deep link", text: "无效的 deep link",

View File

@@ -376,7 +376,6 @@ async function handleImportOuter(app: string): Promise<void> {
} finally { } finally {
setTimeout(async () => { setTimeout(async () => {
await router.push("/achievements"); await router.push("/achievements");
window.location.reload();
}, 1500); }, 1500);
} }
} else { } else {

View File

@@ -2,7 +2,7 @@
* @file router index.ts * @file router index.ts
* @description 路由入口 * @description 路由入口
* @author BTMuli<bt-muli@outlook.com> * @author BTMuli<bt-muli@outlook.com>
* @since Alpha v0.1.2 * @since Beta v0.3.2
*/ */
import { createRouter, createWebHistory } from "vue-router"; import { createRouter, createWebHistory } from "vue-router";
@@ -13,4 +13,12 @@ const router = createRouter({
routes, routes,
}); });
// 解决路由重复问题
router.afterEach((to, from) => {
if (from.name === to.name) {
console.log("路由重复");
window.location.reload();
}
});
export default router; export default router;