wip(VForm): VForm coding
parent
3e002a68f2
commit
558abb86dc
@ -1,15 +1,12 @@
|
|||||||
// 引入windi css
|
// 引入windi css
|
||||||
import '@/plugins/windicss'
|
import '@/plugins/windicss'
|
||||||
|
|
||||||
import { createApp } from 'vue'
|
import { createApp } from 'vue'
|
||||||
import App from './App.vue'
|
import App from './App.vue'
|
||||||
const app = createApp(App)
|
const app = createApp(App)
|
||||||
// 引入多语言
|
|
||||||
import { setupI18n } from '@/plugins/i18n'
|
|
||||||
// 引入状态管理
|
// 引入状态管理
|
||||||
import { setupStore } from '@/store'
|
import { setupStore } from '@/store'
|
||||||
|
|
||||||
setupI18n(app)
|
|
||||||
|
|
||||||
setupStore(app)
|
setupStore(app)
|
||||||
|
|
||||||
app.mount('#app')
|
app.mount('#app')
|
||||||
|
|||||||
@ -1,20 +1,16 @@
|
|||||||
import { createI18n } from 'vue-i18n'
|
import { createI18n } from 'vue-i18n'
|
||||||
import type { App } from 'vue'
|
|
||||||
import type { I18nOptions } from 'vue-i18n'
|
|
||||||
|
|
||||||
export let i18n: ReturnType<typeof createI18n>
|
export const i18n = setupI18n()
|
||||||
|
|
||||||
const messages = Object.fromEntries(
|
function setupI18n() {
|
||||||
|
const messages = Object.fromEntries(
|
||||||
Object.entries(import.meta.globEager('../../locales/*.ts')).map(([key, value]) => {
|
Object.entries(import.meta.globEager('../../locales/*.ts')).map(([key, value]) => {
|
||||||
return [key.slice(14, -3), value.default]
|
return [key.slice(14, -3), value.default]
|
||||||
})
|
})
|
||||||
)
|
)
|
||||||
|
return createI18n({
|
||||||
export function setupI18n(app: App): void {
|
|
||||||
i18n = createI18n({
|
|
||||||
legacy: false,
|
legacy: false,
|
||||||
locale: 'zh-CN',
|
locale: 'zh-CN',
|
||||||
messages
|
messages
|
||||||
} as I18nOptions)
|
})
|
||||||
app.use(i18n)
|
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
Reference in New Issue