0👍
names
is not defined on the vue. Define it in the data method. Once that’s done, realize that the firebase ref is not array-like; so iteration doesn’t make sense. It must be "listened to" with the on()
method…
import {db} from '@/firebase'
data() {
return {
names: null,
}
},
mounted () {
db.ref('names').on('value', dataSnapshot => {
this.names = dataSnapshot.val()
})
},
With this, the markup can iterate v-for="name in names"
- [Vuejs]-Can i use new Map() in vuex and computed?
- [Vuejs]-Vue.js: When implementing the "Simple State Management from Scratch" approach, how to pass on/access the store?
Source:stackexchange.com