我在使用Electron和Vue.js启用Firebase / Firestore脱机持久性时遇到问题。
这是我的代码:firebaseInit.js
import firebase from 'firebase'
import 'firebase/firestore'
import firebaseConfig from './firebaseConfig'
firebase.initializeApp(firebaseConfig)
var db = firebase.firestore()
const settings = {timestampsInSnapshots: true}
db.settings(settings)
db.enablePersistence()
.then(function () {
// Initialize Cloud Firestore through firebase
// var db = firebase.firestore()
})
.catch(function (err) {
if (err.code === 'failed-precondition') {
// Multiple tabs open, persistence can only be enabled
// in one tab at a a time.
// ...
} else if (err.code === 'unimplemented') {
// The current browser does not support all of the
// features required to enable persistence
// ...
}
})
export default db
此代码在控制台上返回错误: