Vuejs 3 createApp using firestorePlugin from vuefire getting Uncaught TypeError: Cannot set property '$unbind' of undefined and no render
Vuejs 3 createApp using firestorePlugin from vuefire getting Uncaught TypeError: Cannot set property '$unbind' of undefined and no render
在我的 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 属性 '$unbind' of undefined
Vue.prototype[unbindName] = function firestoreUnbind(key, reset) {
this._firestoreUnbinds[key](reset);
delete this._firestoreUnbinds[key];
delete this.$firestoreRefs[key];
};
我的 firebase 配置在 firebase.js
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
似乎没有任何更新版本的 Vuefire 支持当前版本的 Vue (3) 或 Firebase (9),尽管这里的回答建议“卸载当前版本版本并安装下一个版本。"
最新稳定版(vuefire@2.2.5) was published "a year ago" (May 2021) and, as the Feb 2021 answer here indicates, the main page of https://vuefire.vuejs.org/改为:
"此版本目前支持 Vue 2 和 Firebase 7。对 Vue 3 / Composition API 和 Firebase 8 的支持正在开发中。"
alpha 版本 (vuefire@3.0.0-alpha.2) 也是“一年前”(2021 年 5 月左右)发布的,它“目前支持 Firebase 7。对 Firebase 8 的支持正在开发中。”
在我的 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 属性 '$unbind' of undefined
Vue.prototype[unbindName] = function firestoreUnbind(key, reset) {
this._firestoreUnbinds[key](reset);
delete this._firestoreUnbinds[key];
delete this.$firestoreRefs[key];
};
我的 firebase 配置在 firebase.js
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
似乎没有任何更新版本的 Vuefire 支持当前版本的 Vue (3) 或 Firebase (9),尽管这里的回答建议“卸载当前版本版本并安装下一个版本。"
最新稳定版(vuefire@2.2.5) was published "a year ago" (May 2021) and, as the Feb 2021 answer here indicates, the main page of https://vuefire.vuejs.org/改为:
"此版本目前支持 Vue 2 和 Firebase 7。对 Vue 3 / Composition API 和 Firebase 8 的支持正在开发中。"
alpha 版本 (vuefire@3.0.0-alpha.2) 也是“一年前”(2021 年 5 月左右)发布的,它“目前支持 Firebase 7。对 Firebase 8 的支持正在开发中。”