[Vuejs]-Filtering array with firebase and vuejs

1👍

✅

The reason is most probably because productosTot is not an Array but “just” a JavaScript Object (that is not an Array), see https://firebase.google.com/docs/reference/js/firebase.firestore.QueryDocumentSnapshot.html#data

Just check the value of precio with an if, as follows:

methods: {

 consulProds {
  let resultado = await db.collection('productos').get()                

  resultado.docs.forEach(doc => {
     let producto = doc.data()
     if (producto.precio == 99) this.productosind.push(producto)    
  })
 }

} 

Leave a comment