Afa*_*han 4 javascript vue.js vuefire vuejs3
在我的 vuejs3 应用程序中,我的 main.js 中有这个简单的代码
import { createApp } from "vue";
import App from "./App.vue";
import { firestorePlugin } from "vuefire";
const app = createApp(App);
app.use(firestorePlugin);
app.mount("#app");
Run Code Online (Sandbox Code Playgroud)
也许我没有app.use(firestorePlugin);正确使用。如果我不这样做,一切都会完美呈现,但这样我会收到此错误
vuefire.esm.js?0ff2:619 Uncaught TypeError: Cannot set property '$unbind' of undefined
at firestorePlugin (vuefire.esm.js?0ff2:619)
at Object.use (runtime-core.esm-bundler.js?5c40:2949)
at eval (main.js?56d7:9)
at Module../src/main.js (app.js:1021)
at __webpack_require__ (app.js:849)
at fn (app.js:151)
at Object.1 (app.js:1034)
at __webpack_require__ (app.js:849)
at checkDeferredModules (app.js:46)
at app.js:925
Run Code Online (Sandbox Code Playgroud)
单击后,它会显示为Uncaught TypeError: Cannot set property '$unbind' of undefined
Vue.prototype[unbindName] = function firestoreUnbind(key, reset) {
this._firestoreUnbinds[key](reset);
delete this._firestoreUnbinds[key];
delete this.$firestoreRefs[key];
};
Run Code Online (Sandbox Code Playgroud)
我在firebase.js中的 firebase 配置
import firebase from "firebase/app";
import "firebase/firestore";
import "firebase/auth";
import "firebase/storage";
const firebaseConfig = {
apiKey: xxxxxxxxxxxxxxxxxxxxxxxx,
authDomain: xxxxxxxxxxxxxxxxxxxxxxxx,
projectId: xxxxxxxxxxxxxxxxxxxxxxxx,
storageBucket: xxxxxxxxxxxxxxxxxxxxxxxx,
messagingSenderId: xxxxxxxxxxxxxxxxxxxxxxxx,
appId: xxxxxxxxxxxxxxxxxxxxxxxx,
};
firebase.initializeApp(firebaseConfig);
export const db = firebase.firestore();
export const auth = firebase.auth();
export const storage = firebase.storage();
Run Code Online (Sandbox Code Playgroud)
任何帮助表示赞赏。如果有什么需要请告诉我
小智 6
在主页https://vuefire.vuejs.org/中,您可以找到以下注释:
注意:此版本目前支持 Vue 2 和 Firebase 7。对 Vue 3 / Composition API 和 Firebase 8 的支持即将推出。
因此,请尝试卸载当前版本并安装下一个版本:
npm install vuefire@next firebase@next
Run Code Online (Sandbox Code Playgroud)