添加登录

This commit is contained in:
浅念
2025-07-11 18:37:16 +08:00
parent 719911918f
commit 713d43f7b4
34 changed files with 1281 additions and 180 deletions
+21
View File
@@ -0,0 +1,21 @@
import type { App } from 'vue'
import { createRouter, createWebHashHistory } from 'vue-router'
import { staticRoutes } from './routes/staticRoutes'
import { configureNProgress } from './utils/utils'
import { setupBeforeEachGuard } from './guards/beforeEach'
import { setupAfterEachGuard } from './guards/afterEach'
// 创建路由实例
export const router = createRouter({
history: createWebHashHistory(),
routes: staticRoutes, // 静态路由
scrollBehavior: () => ({ left: 0, top: 0 }) // 滚动行为
})
// 初始化路由
export function initRouter(app: App<Element>): void {
configureNProgress() // 顶部进度条
setupBeforeEachGuard(router) // 路由前置守卫
setupAfterEachGuard(router) // 路由后置守卫
app.use(router)
}