Closed benjamin-ret closed 2 years ago
In JavaScript, this
is dynamically bound. This means its value changes depending on how its containing function is called. Here, this
does not refer to your component instance. Fortunately, you can save a reference to the component instance and use it later on:
async mounted () { const vm = this; ... function callback(location, error) { ... console.log(vm.$i18n.t('hello') ...
Describe the bug Hi ! I want to use this.$i18n.t in function callback, but it's undefined ([error] - {})
To Reproduce async mounted () { ... function callback(location, error) { ... console.log(this.$i18n.t('hello') ...
Any idea ? Thanks
Smartphone