Uncaught SyntaxError: Need to install with `app.use` function (at message-compiler.esm-bundler.js:54:19)
at createCompileError (message-compiler.esm-bundler.js:54:19)
at createI18nError (vue-i18n.esm-bundler.js:100:12)
at useI18n (vue-i18n.esm-bundler.js:2219:15)
at setup (App.vue:29:18)
at callWithErrorHandling (runtime-core.esm-bundler.js:155:22)
at setupStatefulComponent (runtime-core.esm-bundler.js:7204:29)
at setupComponent (runtime-core.esm-bundler.js:7159:11)
at mountComponent (runtime-core.esm-bundler.js:5508:13)
at processComponent (runtime-core.esm-bundler.js:5483:17)
at patch (runtime-core.esm-bundler.js:5085:21)
意思说createI18n 未创建,就使用了useI18n 方法,造成报错。
看到这个大哥vue3+i18n 国际化处理,后面才知道原来写的顺序错了,因为我先做了
app.mount('#app')
在做了
app.use(i18n)
只需要修改成
app.use(i18n) app.mount('#app')
后续又报错Not available in legacy mode
只需要在createI18n的方法里面加上legacy: false,
即
标签:function,core,use,Vue,app,bundler,js,esm,runtime From: https://www.cnblogs.com/zhian/p/16861595.html