I'm trying to migrate vue2 to vue3 which is "Class Style Component".
It is using vue-i18n. Can I use vue-i18n in Vue3?
package.json
"dependencies": {
"vue": "^3.3.4",
"vue-class-component": "^8.0.0-0",
"vue-i18n": "^9.5.0",
"vue-property-decorator": "^10.0.0-rc.3",
I am facing the following error in browser console.
Uncaught SyntaxError: Must be called at the top of a `setup` function
at createCompileError (message-compiler.esm-browser.js:99:19)
at createI18nError (vue-i18n.mjs:101:12)
at useI18n (vue-i18n.mjs:2294:15)
at TestXXXXXX.vue:20:9
It is saying "Must be called at the top of a setup function".
Is it possible to use "setup function" in Class Style Component?
The following is my code sample.
<script lang="ts">
import { useI18n } from 'vue-i18n';
@Component({
i18n: useI18n()
})
export default class TestXXXXXX extends Vue {
:
Can someone please help me? Thanks in advance.