Closed
Description
Right now the data is created using https://github.com/vuejs/vuefire/blob/master/packages/%40posva/vuefire-core/src/utils.js#L9-L14
Looking at Firestore extensions like Geofirestore that add a distance
property that is lost upon binding with Vuefire. This would allow adding the distance
to the object bound.
It would also allow customizing the key
/id
attribute although I still feel that having a simple string field is nice.
API
The api would be the same for firebase and firestore
Vue.use(firestorePlugin, {
// override createsnapshot
createSnapshot (doc) {
return Object.defineProperty(doc.data(), 'id', {
value: doc.id
})
}
})
this.$bind('item', { createSnapshot })
bindFirestoreRef('item', { createSnapshot })
It will also be nice to provide a way to override globally for vuexfire