Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

115
Visualizações
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 Respostas
Responde à pergunta

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 Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda