vue-i18n插件报错:Uncaught TypeError: _ctx.$t is not a function
在vite脚手架项目当中,使用vue-i18n插件进行国际化多语言时,爆出Uncaught TypeError: _ctx.$t is not a function首先查看vue-i18n的版本号:9.2.0-beta.32修复这个问题添加globalInjection: true到i18n插件当中const i18n = createI18n({legacy: false,locale: "ja
·
在vite脚手架项目当中,使用vue-i18n插件进行国际化多语言时,爆出
Uncaught TypeError: _ctx.$t is not a function
首先
查看vue-i18n的版本号:9.2.0-beta.32
修复这个问题添加 globalInjection: true 到i18n插件当中
const i18n = createI18n({
legacy: false,
locale: "ja",
globalInjection: true,
messages: {
en: {
message: {
language: "English",
greeting: "Hello !"
}
},
ar: {
message: {
language: "العربية",
greeting: "السلام عليكم"
}
},
es: {
message: {
language: "Español",
greeting: "Hola !"
}
}
}
});
export default i18n;
更多推荐
已为社区贡献19条内容
所有评论(0)