[Vuejs]-Vue JS: search filter on numbers

2👍

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())
        );
    });
},

Leave a comment