Create a reactive $translate from Plugin #9424
-
Hello I am trying to create a reactive version of the $translate example in the Plugin documentation. Basically, I would like the $translate()d values to render/update automatically when the current language changes The (simplified) Plugin goes something like this with 'ref()' and 'computed()': But this fails with: 'TypeError: this.fn is not a function' at 'Unhandled error during execution of render function' I suspect there is some missing context/'this' binding, but I can not figure out how to provide it. /Flemming
So I tried a version with 'reactive()' instead but this gives the same error
|
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
From the error message, I think it's reporting that the parameter you pass to Try something like this: computed(() => !i18nDict[key] && "#"+key+"#" || i18nDict[key][opts.curLang] || i18nDict[key][opts.fallBack]) |
Beta Was this translation helpful? Give feedback.
From the error message, I think it's reporting that the parameter you pass to
computed
is not a function. And, indeed, it isn't.Try something like this: