This commit is contained in:
Your Name
2026-03-01 14:17:59 +08:00
parent 65aa12f146
commit a07e844c47
6071 changed files with 777651 additions and 0 deletions
+12
View File
@@ -0,0 +1,12 @@
import type { Router } from 'vue-router'
const modules = import.meta.glob('./*.ts', { eager: true })
export function registerRouteGuard(router: Router) {
Object.keys(modules).forEach((key) => {
const fn = (modules[key] as any).default
if (typeof fn === 'function') {
fn(router)
}
})
}
+23
View File
@@ -0,0 +1,23 @@
import type { Router } from 'vue-router'
import useAppStore from '@/stores/modules/app'
export default function createInitGuard(router: Router) {
router.beforeEach(async () => {
const appStore = useAppStore()
if (Object.keys(appStore.config).length == 0) {
// 获取配置
const data: any = await appStore.getConfig()
// 设置网站logo
let favicon: HTMLLinkElement = document.querySelector('link[rel="icon"]')!
if (favicon) {
favicon.href = data.web_favicon
}
favicon = document.createElement('link')
favicon.rel = 'icon'
favicon.href = data.web_favicon
document.head.appendChild(favicon)
}
})
}