🐛 路由跳转优化

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

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