up
This commit is contained in:
@@ -1,34 +1,37 @@
|
||||
|
||||
|
||||
import { createApp } from 'vue'
|
||||
import { createI18n } from 'vue-i18n'
|
||||
import { createPinia } from 'pinia' // 1. 导入 createPinia
|
||||
import { createPinia } from 'pinia'
|
||||
import App from './App.vue'
|
||||
import router from './router'
|
||||
|
||||
import '@tabler/core/dist/css/tabler.min.css'
|
||||
|
||||
import './assets/main.css'
|
||||
|
||||
// Restore saved theme before app mounts
|
||||
const savedTheme = localStorage.getItem('tablerTheme')
|
||||
if (savedTheme === 'dark' || (!savedTheme && window.matchMedia('(prefers-color-scheme: dark)').matches)) {
|
||||
document.documentElement.classList.add('dark')
|
||||
} else {
|
||||
document.documentElement.classList.remove('dark')
|
||||
}
|
||||
|
||||
import en from './i18n/en.json'
|
||||
import zhCN from './i18n/zh-CN.json'
|
||||
|
||||
const i18n = createI18n({
|
||||
legacy: false, // 使用 Composition API 模式
|
||||
legacy: false,
|
||||
locale: 'en',
|
||||
fallbackLocale: 'en',
|
||||
messages: {
|
||||
en,
|
||||
'zh-CN': zhCN
|
||||
}
|
||||
'zh-CN': zhCN,
|
||||
},
|
||||
})
|
||||
|
||||
const pinia = createPinia()
|
||||
const app = createApp(App)
|
||||
|
||||
app.use(pinia)
|
||||
app.use(router)
|
||||
app.use(i18n)
|
||||
app.use(pinia)
|
||||
|
||||
app.mount('#app')
|
||||
|
||||
Reference in New Issue
Block a user