使用FIrebase onSnapshot()func在Vue async内合并两个集合
我有两个收藏。 当其中一个被更新时,我需要向用户显示合并的两个集合使用FIrebase onSnapshot()func在Vue async内合并两个集合,firebase,vue.js,google-cloud-firestore,merge,async-await,Firebase,Vue.js,Google Cloud Firestore,Merge,Async Await,我有两个收藏。 当其中一个被更新时,我需要向用户显示合并的两个集合 const listRef = await firebase.firestore() .collection("users") .doc(firebase.auth().currentUser.uid) .collection("list") const customListRef = await fireba
const listRef = await firebase.firestore()
.collection("users")
.doc(firebase.auth().currentUser.uid)
.collection("list")
const customListRef = await firebase.firestore()
.collection("users")
.doc(firebase.auth().currentUser.uid)
.collection("customList")
我使用这个异步基函数来检索数据,但我需要为两个集合都这样做
const listRef = await firebase.firestore()
.collection("users")
.doc(firebase.auth().currentUser.uid)
.collection("list")
userRef.onSnapshot(snap => {
this.userLists = []
snap.forEach(doc => {
const flower = doc.data()
product.id = doc.id
this.userList.push(flower)
})
})
}
有没有办法只用一个异步/等待函数合并两个不同的集合