简体   繁体   English

在 Vue CLI (Vue3) 中将 VueAnalytics 导入到 main.ts 时出错

[英]Error on importing VueAnalytics to main.ts in Vue CLI (Vue3)

The following error message is given:给出以下错误消息:

"Argument of type 'typeof VueAnalytics' is not assignable to parameter of type 'Plugin_2'. Type 'typeof VueAnalytics' is not assignable to type '{ install: PluginInstallFunction; }'. Types of property 'install' are incompatible." “'typeof VueAnalytics' 类型的参数不可分配给'Plugin_2' 类型的参数。类型'typeof VueAnalytics' 不可分配给类型'{ install: PluginInstallFunction; }'。属性'install' 的类型不兼容。”

What am I doing wrong?我究竟做错了什么? Thank you very much for your help.非常感谢您的帮助。

 import { createApp } from "vue"; import App from "./App.vue"; import "./registerServiceWorker"; import router from "./router"; import store from "./store"; import VueAnalytics from "vue-analytics"; createApp(App).use(store).use(VueAnalytics, {id:'', router}).mount("#app");

This error indicates that the plugin was built for Vue 2 and is not compatible with Vue 3. Checking the package's npm page reveals that there have been no updates in the last year.这个错误表明该插件是为Vue 2构建的,并且与Vue 3不兼容。检查包的npm页面发现去年没有更新。 The requirement also lists Vue 2.该要求还列出了 Vue 2。

The last Github commit was in January.上一次Github提交是在一月份。

Following some links from the package's Github leads to this package which looks like it may work with Vue 3.按照包的 Github 中的一些链接会导致这个 package看起来它可以与 Vue 3 一起使用。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM