首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >如何使用“VueI18n”和“vue2.0”?`新的VueI18n({..})‘report’没有构造标志‘error

如何使用“VueI18n”和“vue2.0”?`新的VueI18n({..})‘report’没有构造标志‘error
EN

Stack Overflow用户
提问于 2021-10-08 06:23:18
回答 1查看 1.2K关注 0票数 1

我跟踪了安装指南,但在Vue.use(VueI18n);const i18n = new VueI18n({...});上出现了错误。

Vue.use(VueI18n)报告

代码语言:javascript
复制
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({...});报告

代码语言:javascript
复制
This expression is not constructable.
  Type 'typeof import(".../node_modules/vue-i18n/dist/vue-i18n")' has no construct signatures.

这是我的Vue实例。

代码语言:javascript
复制
new Vue({
  vuetify,
  router,
  i18n,
  render: (h) => h(App),
}).$mount("#app");
EN

回答 1

Stack Overflow用户

发布于 2022-10-15 12:31:02

它连接您使用的Vue version 2,尝试通过键入以下命令安装兼容版本的VueI18n:

npm安装vue-i18n@8 -保存

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/69491378

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档