Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

125
Vistas
Vue JS: search filter on numbers

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?

about 4 years ago · Juan Pablo Isaza
1 Respuestas
Responde la pregunta

0

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())
        );
    });
},
about 4 years ago · Juan Pablo Isaza Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda