Closed ramstein74 closed 5 years ago
Hi @ramstein74 Thank for opening this issue.
Basically, you can bind your collection manually by calling $binding
which returns a promise, once the promise is resolved, you can write the logic you want.
....
mounted () {
var source = firebase.firestore().collection("MyCollection")
this.$binding('MyCollection', source).then((collection) => {
// write the logic
})
}
....
Thank you!
Hi @amranidev
I found when the collections not have anything (I use where to filter it) then not resolve to execute the logic in closure
Hi @Refereer, can you show me your code?
mounted () {
// Binding Collections
this.$binding('payments', this.paymentFilteredDatabase)
.then((payments) => {
this.isLoaded = true
this.$emit('isLoaded', true)
if (payments.length > 0) {
console.log('payments: ', payments)
} else {
console.log('there no payments on this accounts email: ', this.user.email)
}
})
},
computed: {
paymentFilteredDatabase () {
if (this.isAdmin) {
return db.collection('payments')
}
return db.collection('payments').where('user_email', '==', this.user.email)
}
}
if the promise is not resolved, I believe there must be an error or an exception, can you add .catch
to the promise and see what kind of error it throws.
Thanks!
How to trigger an event after db.collection('mycoll') is called ?
I´m using a vuetify data-table with the loading indicator and need to set it to false after the table is populated.
regards