my below code working good when i search for letters, but when it come for numbers like flat_number
only it gives me error flat.flat_number.toLowerCase is not a function
filteredList() {
return this.Flats.filter((flat) => {
return (
//i tried commented code but it didn;t work
// this.Flats.filter(flat_number => String(flat_number).includes(this.search)) ||
flat.buyer
.toLowerCase()
.includes(this.search.toLowerCase()) ||
flat.flat_number //flat_number not working
.toLowerCase()
.includes(this.search.toLowerCase()) ||
flat.city
.toLowerCase()
.includes(this.search.toLowerCase())
);
});
},
any help please?
There is no toLowerCase
function for Number .
If you want to treat flat as a String type, then do that conversion before comparing to search string.
filteredList() {
return this.Flats.filter((flat) => {
return (
flat.buyer.toString()
.toLowerCase()
.includes(this.search.toLowerCase()) ||
flat.flat_number.toString()
.toLowerCase()
.includes(this.search.toLowerCase()) ||
flat.city.toString()
.toLowerCase()
.includes(this.search.toLowerCase())
);
});
},
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.