Browse Source

:fix: 修复国际化bug导致页面启动报错

pull/20/head
yangs 1 year ago
parent
commit
6e11a23c47
  1. 6
      package.json
  2. 4
      src/App.vue
  3. 6
      src/locale/index.js

6
package.json

@ -28,12 +28,12 @@
},
"devDependencies": {
"@babel/eslint-parser": "^7.15.8",
"@babel/core":"7.11.0",
"@babel/core": "7.18.6",
"@types/node": "^14.17.9",
"@vue/compiler-sfc": "^3.2.33",
"@zougt/vite-plugin-theme-preprocessor": "^1.4.5",
"babel-plugin-import": "^1.13.3",
"eslint":"^7.5.0",
"eslint": "^7.5.0",
"eslint-plugin-vue": "^7.18.0",
"rollup": "^2.70.1",
"sass": "^1.32.8",
@ -64,4 +64,4 @@
"last 2 versions",
"not dead"
]
}
}

4
src/App.vue

@ -7,7 +7,7 @@
//test
import {computed, defineComponent} from "vue";
import {useStore} from "vuex";
import {useI18n} from 'vue-i18n/index';
import {useI18n} from 'vue-i18n';
import {toggleTheme} from "@zougt/vite-plugin-theme-preprocessor/dist/browser-utils.js";
export default defineComponent({
name: 'App',
@ -31,4 +31,4 @@ export default defineComponent({
#app, body, html {
height: 100%;
}
</style>
</style>

6
src/locale/index.js

@ -1,6 +1,6 @@
import config from "../configure/pear.config.js";
import { nextTick } from 'vue'
import { createI18n } from 'vue-i18n/index'
import { createI18n } from 'vue-i18n'
const DEFAULT_LANG = localStorage.getItem("pear_lang") ? localStorage.getItem("pear_lang") : config.defaultLanguage;
@ -9,7 +9,7 @@ const i18n = setupI18n({
locale: DEFAULT_LANG,
messages: {},
fallbackLocale: DEFAULT_LANG,
globalInjection: true,
globalInjection: true
});
export function setupI18n(options = { locale: 'en' }) {
@ -42,4 +42,4 @@ loadLocaleMessages(i18n, DEFAULT_LANG).then(() => {
// to do
});
export default i18n;
export default i18n;
Loading…
Cancel
Save