fix: 修改i18n出现的bug
This commit is contained in:
parent
beabebaadc
commit
3ea51a514b
|
|
@ -11,6 +11,7 @@
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
import colorTool from "@/utils/color";
|
import colorTool from "@/utils/color";
|
||||||
|
import i18n from '@/locales'
|
||||||
export default {
|
export default {
|
||||||
name: "App",
|
name: "App",
|
||||||
data() {
|
data() {
|
||||||
|
|
@ -26,7 +27,8 @@ export default {
|
||||||
},
|
},
|
||||||
computed: {
|
computed: {
|
||||||
locale() {
|
locale() {
|
||||||
return this.$i18n.messages[this.$i18n.locale].el;
|
const lang = i18n.global.locale.value
|
||||||
|
return i18n.global.messages.value?.[lang]?.el
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
created() {
|
created() {
|
||||||
|
|
|
||||||
|
|
@ -21,8 +21,9 @@ const messages = {
|
||||||
const i18n = createI18n({
|
const i18n = createI18n({
|
||||||
locale: tool.data.get("APP_LANG") || sysConfig.LANG,
|
locale: tool.data.get("APP_LANG") || sysConfig.LANG,
|
||||||
fallbackLocale: 'zh-cn',
|
fallbackLocale: 'zh-cn',
|
||||||
globalInjection: true,
|
globalInjection: false,
|
||||||
messages,
|
messages,
|
||||||
|
legacy: false
|
||||||
})
|
})
|
||||||
|
|
||||||
export default i18n;
|
export default i18n;
|
||||||
|
|
|
||||||
|
|
@ -33,6 +33,7 @@ app.use(DataVVue3);
|
||||||
|
|
||||||
//挂载app
|
//挂载app
|
||||||
app.mount("#app");
|
app.mount("#app");
|
||||||
|
app.config.globalProperties.$t = i18n.global.t
|
||||||
|
|
||||||
const debounce = (fn, delay) => {
|
const debounce = (fn, delay) => {
|
||||||
let timer = null;
|
let timer = null;
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue