I am working on a Vue.js application where the idea is to allow coaches to code specific plays for analysis with a ticking clock to set when the action happened in game time.
For example, user clicks 'time on' to start the clock, clicks 'pass', the value is set in the Vuex Store in an array called localStats. So it would look something like the following:
localStats[
{
stat: 'Pass',
matchTime: '00:02'
},
{
stat: 'Dropped Pass',
matchTime: '00:04'
}
]
The idea was to store these locally so that:
Would there be a way to take all individual objects from an array and set all of the array objects as separate documents in Firestore? Or am I going about this all wrong?
I am dumb. forEach. Set it up where when the user indicated the half is over, submit all documents from the half:
const stats = this.$store.state.localStats;
var matchId = this.$route.params.matchId
stats.forEach(function(object){
db.collection('matches').doc(matchId).collection('stats').add({
object
})
})
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.