【发布时间】:2021-06-09 19:53:35
【问题描述】:
我有几个不同的查询需要保留“实时”数据。当我对查询进行硬编码时,它成功显示了数据库中发生的所有实时更改。但是当我传递一个有效载荷时,数据在重新加载之前不会改变。
工作查询:
getOnline: firestoreAction(({ bindFirestoreRef }) => {
return bindFirestoreRef('online', db.collection('units').where('unit.on', '==', true).orderBy('info.timestamp', 'desc').orderBy('unit.status'))
}),
Payload Query 无效:获取数据一次
getFilterSystemId: firestoreAction(({ bindFirestoreRef} , payload) => {
return bindFirestoreRef('filterBySystemId', db.collection('units').where('unit.group', '==', payload.group).orderBy('info.timestamp', 'desc').orderBy('unit.status'))
}),
我只是简单地传递有效载荷:
filterSystemId(grouphex){
let payload = {
group: grouphex.toString(),
}
this.getFilterSystemId(payload);
},
如何传递有效负载并获取数据库中发生的任何更改的实时更新?
【问题讨论】:
标签: javascript firebase google-cloud-firestore vuejs2 vuefire