4

每个关于如何在 Vue 中使用 Firebase 的教程都说在 main.js 文件中我必须添加 Vue.use(VueFire); 这是有道理的。但是后来我收到了这条消息 export 'default' (imported as 'VueFire') was not found in 'vuefire'。

我尝试使用 import * as VueFire from 'vuefire' 并且它不再给出错误消息,但它似乎没有使用插件。

这是 main.js 文件

import Vue from 'vue'
import App from './App.vue'
import router from './router'

import VueFire from 'vuefire'

Vue.config.productionTip = false

Vue.use(VueFire);

new Vue({
  router,
  render: h => h(App)
}).$mount('#app')
4

2 回答 2

17

我认为较旧的文档。试试这个。

import { firestorePlugin } from 'vuefire'
Vue.use(firestorePlugin)
于 2019-06-02T17:25:26.583 回答
0

只是在这里查看新文档 https://vuefire.vuejs.org/vuefire/getting-started.html

 import Vue from 'vue' import { firestorePlugin } from 'vuefire'

 Vue.use(firestorePlugin)
于 2020-01-23T03:27:44.723 回答