What’s wrong with my search function? It works for the first line (city values), but not for the others. If I remove everything but the cityValues line, or change the && to ||, the function works, but not like this.
I’m trying to search through an array of parameters on each value. Meaning: the user has the possibility to select multiple options from multiple dropdowns, and see the results.
For some context, cityValue, zipValue etc are arrays. cityValue is an array of strings, and the rest are arrays of numbers.
Thanks
computed: {
filteredPropertyTypes() {
return this.propertyTypes.filter(rental => {
return this.cityValue.indexOf(rental.city) !== -1 &&
this.zipValue.toString().indexOf(rental.zip.toString()) !== -1 &&
this.bedroomsValue.toString().indexOf(rental.bedrooms.toString()) !== -1 &&
this.bathroomsValue.toString().indexOf(rental.bathrooms.toString()) !== -1 &&
rental.rent.toString().includes(this.rentValue.toString());
})
}
},
