繁体   English   中英

带有 Vue 3 的 Vuefire 抛出 Vue.use 错误

[英]Vuefire with Vue 3 throwing Vue.use error

所以我创建了一个 vue 应用程序并从 vue 模块导入了 Vue 但我收到了这个错误

ERROR in src/main.ts:4:5
TS2339: Property 'use' does not exist on type 'typeof import("/data/data/com.termux/files/home/ishankbg.tech/node_modules/vue/dist/vue")'.
    2 | import App from './App.vue'
    3 | import { firestorePlugin } from 'vuefire';
  > 4 | Vue.use(firestorePlugin);
      |     ^^^
    5 | createApp(App).mount('#app');
    6 |

我在我的 vue 应用程序中使用 typescript。 我使用@vue/cli 生成了项目。 我想使用 vuefire 的 firestorePlugin。

我正在使用 Vue3 这里是源代码

import Vue, { createApp } from 'vue'
import App from './App.vue'
import { firestorePlugin } from 'vuefire';
Vue.use(firestorePlugin);
createApp(App).mount('#app');

我不确定是什么导致了这个错误

Vue 3 尚不支持Vuefire 从主页:

注意:此版本目前支持 Vue 2 和 Firebase 7。支持 Vue 3 / Composition API 和 Firebase 8 正在开发中。

Vue.use是 Vue 2 安装插件的方式。 一旦 Vuefire 支持 Vue 3,请使用app.use而不是Vue.use 在 Vue 3 中, Vue不是"vue" package 的有效导出:

import { createApp } from 'vue'
import App from './App.vue'
import { firestorePlugin } from 'vuefire';

const app = createApp(App);
app.use(firestorePlugin);
app.mount("#app");

暂无
暂无

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

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