Closed ll931217 closed 6 years ago
Hi @ll931217
A quick idea: I think this could be due to the use of an arrow function with the change method in your app component. Arrow functions change the this
context to the current closure. Therefore this.$i18n would not point the vue component instance anymore.
Could you try to change the method to:
export default {
methods: {
change(key) {
console.log('i18n:', this.$i18n)
}
}
}
@tikiatua Hello, seems that like fixed the problem. Just learnt something new about the arrow functions, thank you!
Hello,
As the title says, the global object
this.$i18n
is returningundefined
.Here is my
main.js
file:In my
App.vue
file I have the following to check ifthis.$i18n
is defined:Anyone have an idea why
this.$i18n
is undefined?