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

344
Visualizações
Vue 3 - need help to highlight text from input

I'm working on a small project which gets data from a json file and displays it in table format. Made search feature which is working fine, but I'd also like if the inputted letter/word will be highlighted(like user typing something into search input and that typed thing is being styled differently so it stands out in the result of the search). Can't figure out how to implement this, any help would be appreciated. I've really stuck on this one.

<tr v-for="teacher in mySearchFunc" :key="teacher.id">
  <td><router-link :to="{ name: 'Home'}">{{teacher.name}} </router-link></td>
  <td>{{teacher.birthday}}.{{teacher.birthmonth}}.{{teacher.birthyear}}</td>
  <td>{{teacher.phoneNum}}</td>
  <td>{{teacher.type}}</td>
  <td>{{teacher.id}}</td>
  <td><router-link to="#" class="subjectsBtn">Subjects</router-link></td>
  <td><button class="edit_btn"><span class="material-icons">edit</span></button></td>
  <td><button class="delete_btn"><span class="material-icons">delete</span></button></td>
</tr>

export default {
  data() {
    return {
      teachers: [],
      search: ''
    }
  }, 
  computed: {
    mySearchFunc() {
      return this.teachers.filter(teacher => 
       teacher.name.toLowerCase().includes(this.search.toLowerCase()))
    }
  }
}
about 4 years ago · Juan Pablo Isaza
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