【发布时间】:2018-04-30 07:37:36
【问题描述】:
我有这个文档
let wall = firebase.wallCollection;
然后我想用多个 where 过滤它:
- 位置(位置 == 过滤器位置)
- 价格(价格
这是我在 Vue 上的过滤方法
filterResult(){
let self = this;
if(self.filterLocation!=""){
wall.where('location','==', self.filterLocation);
console.log("Location flag");
}
if(parseInt(self.filterMaximumPrice)!=0){
dinding.where('price','<', parseInt(self.filterMaximumPrice));
console.log("Price flag");
}
wall.get()
.then(snapshots => {
snapshots.forEach(doc => {
self.listFilteredWall.push(doc.data());
}, this);
})
}
问题是 2 where 功能无法正常工作,并且仍然在没有过滤器的情况下提供所有墙输出。
如何解决这个问题?
【问题讨论】:
-
大多数情况下,当任何一个值为空时,就会出现此问题。
标签: arrays firebase vue.js google-cloud-firestore