I'm attempting to perform a search using Firebase within my VueJS Code.
export default {
data () {
return {
listings: [],
searchData: {
keyword: ""
}
}
},
name: 'SearchScreen',
components: {
ValidationProvider,
ValidationObserver
},
firebase: {
listings: listingsRef
},
methods: {
search () {
console.log(this.searchData.keyword)
listingsRef.orderByChild('location').equalTo(this.searchData.keyword).on('value', function (snapshot){
console.log(snapshot.val())
return{
listings: snapshot.val()
}
})
}
}
}
Upon calling console.log
, the data is being successfully filtered and displayed in the console. However, I am facing difficulty updating the 'listings' in the component data with the response received from Firebase. Attempted using this.listing
, but it was not effective. How can I overcome this issue?