Skip to content

Commit

Permalink
feat: 使用 ts 文件导入
Browse files Browse the repository at this point in the history
  • Loading branch information
ikxin committed Aug 8, 2023
1 parent 25f0edd commit ce787ac
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 1 deletion.
1 change: 1 addition & 0 deletions src/locales/en/activation.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export default {}
3 changes: 3 additions & 0 deletions src/locales/en/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
export default {
author: 'Github@ikxin'
}
6 changes: 6 additions & 0 deletions src/locales/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
const en = import.meta.glob('./en/*.ts', {
import: 'default',
eager: true
})

export default { en }
4 changes: 4 additions & 0 deletions src/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,10 @@ import { router } from '@/router'
import { createI18n } from 'vue-i18n'
import messages from '@intlify/unplugin-vue-i18n/messages'

import locales from '@/locales'

console.log(locales)

import '@/styles/custom.less'
import 'virtual:uno.css'
import '@/styles/style.css'
Expand Down
2 changes: 1 addition & 1 deletion vite.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ export default defineConfig({
]
}),
VueI18nPlugin({
include: [resolve(__dirname, './src/locales/**')]
include: [resolve(__dirname, './src/locales/**/*.json')]
})
],
resolve: {
Expand Down

0 comments on commit ce787ac

Please sign in to comment.