gpt4 book ai didi

javascript - Vuejs 3 createApp 使用来自 vuefire 的 firestorePlugin 获取 Uncaught TypeError : Cannot set property '$unbind' of undefined and no render

转载 作者:行者123 更新时间:2023-12-05 01:08:23 24 4
gpt4 key购买 nike

在我的 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");

也许我没有正确使用 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

点击后显示如下 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];
};

我在 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();

感谢任何帮助。如果有什么需要请告诉我

最佳答案

在首页https://vuefire.vuejs.org/你会发现这个注释:

Note: This version currently supports Vue 2 and Firebase 7. Support for Vue 3 / Composition API and Firebase 8 is on the way.

所以尝试卸载当前版本并安装下一个版本:

 npm install vuefire@next firebase@next

关于javascript - Vuejs 3 createApp 使用来自 vuefire 的 firestorePlugin 获取 Uncaught TypeError : Cannot set property '$unbind' of undefined and no render,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/66103763/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com