[Vuejs]-How to push multiple data in same object?

0👍

db.collection("form").where("posted_at", ">=", 1)
.get()
.then(querySnapshot => {
  querySnapshot.forEach(doc=> {
    console.log(doc.id, " => ", doc.data());
    this.array.push({...doc.data(), id: doc.id});
  });
})

Alternatively, if the spread syntax isn’t supported by your platform, you can use Object.assign() like so:

db.collection("form").where("posted_at", ">=", 1)
.get()
.then(querySnapshot => {
  querySnapshot.forEach(doc=> {
    console.log(doc.id, " => ", doc.data());
    this.array.push(Object.assign({}, doc.data(), {id: doc.id}));
  });
})

Leave a comment