Cannot read property of undefined
Closed this issue · 4 comments
Hi, I've tried this plugin, but I don't know how to override this error :
main.js
import MultiLanguage from 'vue-multilanguage' Vue.use(MultiLanguage, { default: 'fr', en: { connection: 'Connection' }, fr: { connection: 'Connexion' } })
LoginPanel.vue
template div span(v-lang.connection)
The error :
TypeError: Cannot read property 'connection' of undefined at Proxy.render (eval at ./node_modules/vue-loader/lib/template-compiler/index.js?{"id":"data-v-ab120e6a","hasScoped":true,"transformToRequire":{"video":["src","poster"],"source":"src","img":"src","image":"xlink:href"},"buble":{"transforms":{}}}!./node_modules/vue-loader/lib/template-compiler/preprocessor.js?engine=pug!./node_modules/vue-loader/lib/selector.js?type=template&index=0!./src/components/LoginPanel.vue (app.js:2333), <anonymous>:134:61) at VueComponent.Vue._render (vue.esm.js?efeb:4474) at VueComponent.updateComponent (vue.esm.js?efeb:2765) at Watcher.get (vue.esm.js?efeb:3115) at new Watcher (vue.esm.js?efeb:3104) at mountComponent (vue.esm.js?efeb:2772) at VueComponent.Vue$3.$mount (vue.esm.js?efeb:8429) at VueComponent.Vue$3.$mount (vue.esm.js?efeb:10790) at init (vue.esm.js?efeb:4065) at createComponent (vue.esm.js?efeb:5512)
Maybe there is something I'm not doing well ...
Thanks for any help.
I've done like this :
p {{translate('connection')}}
It works like a charm but it's not as pretty as the other method...
@steftanguy,
You can take a look at the demo provided in the repo. It helped me a lot!
Hi @steftanguy
I need see it, I think that because yout use the pug template. But I need verify it.
I rewrote the plugin, to give more performance and improve usage. In this new version (> 4) I applied its issue.
In the new version the return of errors has been improved, so if it gives some error I can help better.