refactor: 优化路由守卫代码(同步 GiDemo 更新)

This commit is contained in:
2024-12-08 19:56:35 +08:00
parent abacb267aa
commit 7c509fa737
3 changed files with 68 additions and 59 deletions

View File

@@ -1,6 +1,7 @@
import { createRouter, createWebHistory } from 'vue-router'
import { useRouteStore } from '@/stores'
import { constantRoutes, systemRoutes } from '@/router/route'
import { setupRouterGuard } from '@/router/guard'
const router = createRouter({
history: createWebHistory(import.meta.env.BASE_URL),
@@ -8,6 +9,8 @@ const router = createRouter({
scrollBehavior: () => ({ left: 0, top: 0 }),
})
setupRouterGuard(router)
/**
* @description 重置路由
* @description 注意:所有动态路由路由必须带有 name 属性,否则可能会不能完全重置干净