It seems that the issue at hand is more related to general JavaScript rather than being specific to VueJS. I have a Vue Method set up to make a Firebase Call and return the requested object, which is functioning properly:
methods: {
getSponsor (key) {
db.ref('businesses').child(key).on('value', snap => {
console.log(snap.val())
return snap.val()
})
}
}
[Object]
However, when I invoke this method from a computed property, it returns as undefined
:
computed: {
sponsor () {
console.log(this.getSponsor(key))
return(this.getSponsor(key))
}
}
Undefined
I'm curious as to why this is happening. Could it be related to how the method is being returned?