feat 搭建架构骨架

This commit is contained in:
Ironsp
2026-09-24 09:09:47 +08:00
parent dd9f6b77a4
commit 7a2efa3fea
180 changed files with 18967 additions and 9 deletions

16
src/router/guard.ts Normal file
View File

@@ -0,0 +1,16 @@
import type { Router } from 'vue-router'
import { storage } from '@/utils/storage'
/** 路由守卫:登录态校验 + document.title */
export function setupGuard(router: Router): void {
router.beforeEach((to) => {
if (to.meta.requiresAuth && !storage.get<string>('token')) {
return { path: '/login', query: { redirect: to.fullPath } }
}
return true
})
router.afterEach((to) => {
document.title = to.meta.title ? `${to.meta.title} - 虫子智造` : '虫子智造'
})
}