build: 设置多语言
@ -0,0 +1,19 @@
|
||||
{
|
||||
"0 debug pnpm:scope": {
|
||||
"selected": 1
|
||||
},
|
||||
"1 error pnpm": {
|
||||
"errno": 1,
|
||||
"code": "ELIFECYCLE",
|
||||
"pkgid": "new-element-plus-admin@0.0.0",
|
||||
"stage": "clean",
|
||||
"script": "npx rimraf docs/node_modules && npx rimraf node_modules",
|
||||
"pkgname": "new-element-plus-admin",
|
||||
"err": {
|
||||
"name": "pnpm",
|
||||
"message": "new-element-plus-admin@0.0.0 clean: `npx rimraf docs/node_modules && npx rimraf node_modules`\nExit status 1",
|
||||
"code": "ELIFECYCLE",
|
||||
"stack": "pnpm: new-element-plus-admin@0.0.0 clean: `npx rimraf docs/node_modules && npx rimraf node_modules`\nExit status 1\n at EventEmitter.<anonymous> (C:\\Users\\admin\\AppData\\Roaming\\nvm\\v16.0.0\\node_modules\\pnpm\\dist\\pnpm.cjs:103540:20)\n at EventEmitter.emit (node:events:365:28)\n at ChildProcess.<anonymous> (C:\\Users\\admin\\AppData\\Roaming\\nvm\\v16.0.0\\node_modules\\pnpm\\dist\\pnpm.cjs:91469:18)\n at ChildProcess.emit (node:events:365:28)\n at maybeClose (node:internal/child_process:1067:16)\n at Process.ChildProcess._handle.onexit (node:internal/child_process:301:5)"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Before Width: | Height: | Size: 4.2 KiB After Width: | Height: | Size: 4.2 KiB |
|
After Width: | Height: | Size: 2.1 KiB |
|
After Width: | Height: | Size: 96 KiB |
|
After Width: | Height: | Size: 4.7 KiB |
|
After Width: | Height: | Size: 6.2 KiB |
|
After Width: | Height: | Size: 4.0 KiB |
|
After Width: | Height: | Size: 4.0 KiB |
|
After Width: | Height: | Size: 450 KiB |
|
After Width: | Height: | Size: 2.1 KiB |
|
Before Width: | Height: | Size: 6.7 KiB |
@ -0,0 +1,8 @@
|
||||
export default {
|
||||
test: {
|
||||
about: 'About'
|
||||
},
|
||||
test2: {
|
||||
go: 'Go'
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,8 @@
|
||||
export default {
|
||||
test: {
|
||||
about: '关于'
|
||||
},
|
||||
test2: {
|
||||
go: '去'
|
||||
}
|
||||
}
|
||||
@ -1,8 +1,14 @@
|
||||
import { createApp } from 'vue'
|
||||
|
||||
import App from './App.vue'
|
||||
|
||||
import 'virtual:windi.css'
|
||||
const app = createApp(App)
|
||||
|
||||
// 引入windi css
|
||||
import '@/plugins/windicss'
|
||||
|
||||
import 'virtual:windi-devtools'
|
||||
// 引入多语言
|
||||
import { setupI18n } from '@/plugins/i18n'
|
||||
setupI18n(app)
|
||||
|
||||
createApp(App).mount('#app')
|
||||
app.mount('#app')
|
||||
|
||||
@ -0,0 +1,17 @@
|
||||
import { createI18n } from 'vue-i18n'
|
||||
import type { App } from 'vue'
|
||||
|
||||
const messages = Object.fromEntries(
|
||||
Object.entries(import.meta.globEager('../../locales/*.ts')).map(([key, value]) => {
|
||||
return [key.slice(14, -3), value.default]
|
||||
})
|
||||
)
|
||||
|
||||
export function setupI18n(app: App<Element>): void {
|
||||
const i18n = createI18n({
|
||||
legacy: false,
|
||||
locale: 'zh-CN',
|
||||
messages
|
||||
})
|
||||
app.use(i18n)
|
||||
}
|
||||
@ -0,0 +1,3 @@
|
||||
import 'virtual:windi.css'
|
||||
|
||||
import 'virtual:windi-devtools'
|
||||