mirror of
https://github.com/BTMuli/TeyvatGuide.git
synced 2025-12-12 09:18:14 +08:00
🐛 路由跳转优化
This commit is contained in:
@@ -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!",
|
||||||
|
|||||||
@@ -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 {
|
||||||
|
|||||||
@@ -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;
|
||||||
|
|||||||
Reference in New Issue
Block a user