我正在尝试使用多种语言制作应用程序。
我按照文档说的做了,但没有用。
这是我的代码。
window.Vue = require('vue');
import Vuetify from './Vuetify/vuetify';
import en from './Vuetify/Lang/en/en.ts';
import es from './Vuetify/Lang/es/es.ts';
Vue.use(Vuetify, {
lang: {
locales: {
es,
en,
},
current: 'es'
}
})
const app = new Vue({
el: '#app',
components: {
"vue-landing": require('./components/ExampleComponent.vue'),
},
created() {
this.$vuetify.lang.current = 'es'
},
}).$mount('#app');
Run Code Online (Sandbox Code Playgroud)
在我的组件中
<template>
<v-content>
{{ $vuetify.t('noDataText') }}
</v-content>
</template>
Run Code Online (Sandbox Code Playgroud)
一切正常编译没有错误,但它不翻译任何东西。结果总是我在函数中写的。
在这种情况下,出现的是
无数据文本