【发布时间】:2021-07-12 15:54:06
【问题描述】:
我在 v-select 中使用 vue i18n 翻译信息时遇到问题。所有其他翻译工作,但不是这个......我没有找到解决方案......
HTML:
<v-card-text>
<v-select v-model="model" :items="propsList" :items-text="propsList.text" label="Select a reason:" clearable />
</v-card-text>
数据例如:($t = i18n)
propsList: [
{ text: this.$t('XXX.A') as string, value: 'X' },
{ text: this.$t('XXX.B') as string, value: 'Y' },
{ text: this.$t('XXX.C') as string, value: 'Z' },
],
翻译:
{ "en": {
"XXX" : {
"A": "A", ...}},
"fr": {
"XXX" : {
"A": "A", ...}},
在我的 App.vue 中:
data ... :
languages: [
{ text: 'English', value: 'en' },
{ text: 'Français', value: 'fr' },
],
watch: {
language(val: string) {
this.setLanguage(val);
this.$i18n.locale = val;
},
},
我一直在努力!但是在此先感谢:)
【问题讨论】:
标签: vue.js vuetify.js vue-i18n