2025-12-18 13:50:39 +08:00
|
|
|
import { createApp } from 'vue'
|
|
|
|
|
import { createPinia } from 'pinia'
|
|
|
|
|
import App from './App.vue'
|
|
|
|
|
import router from './router'
|
|
|
|
|
import i18n from './i18n'
|
|
|
|
|
import './style.css'
|
|
|
|
|
|
|
|
|
|
const app = createApp(App)
|
2026-01-10 18:37:44 +08:00
|
|
|
const pinia = createPinia()
|
|
|
|
|
app.use(pinia)
|
|
|
|
|
|
|
|
|
|
// Initialize settings from injected config BEFORE mounting (prevents flash)
|
|
|
|
|
// This must happen after pinia is installed but before router and i18n
|
|
|
|
|
import { useAppStore } from '@/stores/app'
|
|
|
|
|
const appStore = useAppStore()
|
|
|
|
|
appStore.initFromInjectedConfig()
|
|
|
|
|
|
|
|
|
|
// Set document title immediately after config is loaded
|
|
|
|
|
if (appStore.siteName && appStore.siteName !== 'Sub2API') {
|
|
|
|
|
document.title = `${appStore.siteName} - AI API Gateway`
|
|
|
|
|
}
|
|
|
|
|
|
2025-12-18 13:50:39 +08:00
|
|
|
app.use(router)
|
|
|
|
|
app.use(i18n)
|
2025-12-18 20:45:56 +08:00
|
|
|
|
|
|
|
|
// 等待路由器完成初始导航后再挂载,避免竞态条件导致的空白渲染
|
|
|
|
|
router.isReady().then(() => {
|
|
|
|
|
app.mount('#app')
|
|
|
|
|
})
|