My search function seems to be having some issues. It works fine when filtering by city values, but not for the other parameters. If I simplify it to just filter by cityValues or change the && to ||, then it works as expected.
The aim is to search through an array of parameters based on user selections from dropdown menus and display the relevant results.
Just to provide more details, cityValue, zipValue, etc are all arrays. cityValue contains strings, while the rest consist of numbers.
Thank you
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());
})
}
},