我跟踪了安装指南,但在Vue.use(VueI18n);和const i18n = new VueI18n({...});上出现了错误。
Vue.use(VueI18n)报告
No overload matches this call.
Overload 1 of 2, '(plugin: PluginObject<unknown> | PluginFunction<unknown>, options?: unknown): VueConstructor<Vue>', gave the following error.
Argument of type 'typeof import(".../node_modules/vue-i18n/dist/vue-i18n")' is not assignable to parameter of type 'PluginObject<unknown> | PluginFunction<unknown>'.
Property 'install' is missing in type 'typeof import(".../node_modules/vue-i18n/dist/vue-i18n")' but required in type 'PluginObject<unknown>'.
Overload 2 of 2, '(plugin: PluginObject<any> | PluginFunction<any>, ...options: any[]): VueConstructor<Vue>', gave the following error.
Argument of type 'typeof import(".../node_modules/vue-i18n/dist/vue-i18n")' is not assignable to parameter of type 'PluginObject<any> | PluginFunction<any>'.
Property 'install' is missing in type 'typeof import(".../node_modules/vue-i18n/dist/vue-i18n")' but required in type 'PluginObject<any>'.
12 | import VueI18n from "vue-i18n";
13 |
> 14 | Vue.use(VueI18n);和const i18n = new VueI18n({...});报告
This expression is not constructable.
Type 'typeof import(".../node_modules/vue-i18n/dist/vue-i18n")' has no construct signatures.这是我的Vue实例。
new Vue({
vuetify,
router,
i18n,
render: (h) => h(App),
}).$mount("#app");发布于 2022-10-15 12:31:02
它连接您使用的Vue version 2,尝试通过键入以下命令安装兼容版本的VueI18n:
npm安装vue-i18n@8 -保存
https://stackoverflow.com/questions/69491378
复制相似问题