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

247
Visualizações
Get Input event to fire off on Android (using Nuxt)

I have an input field with a function that filters a list each time a key is pressed, and outputs the results of the filtered list in the browser.

On desktop it works great, however the list only gets displayed on Android mobiles after pressing space or the enter key. To make it stranger, after pressing space or the "enter" arrow on the Android keyboard, the list behaves like it should; filtering and displaying the list as you type. Is there a way to get the behavior I am looking for? I have tried @keydown, @keyup and @keypress.

Input field with v-model

 <input
          v-model="searchValue"
          type="text"
          @input="filterStories"
        />

Filter Function and Data Properties

  data() {
    return {
      searchValue: '',
      filteredStories: []
  }
},
    methods: {
    filterStories() {
      if (this.stories.length) {
        let filtered = this.stories.filter(
          (story) =>
            story.name.toLowerCase().includes(this.searchValue.toLowerCase())
        )

        if (!this.searchValue) {
          this.filteredStories = []
        } else {
          this.filteredStories = filtered
        }
      }
    }

Output list in browser

       <li
          v-for="(story, i) in filteredStories"
          v-else-if="
            stories.length && filteredStories.length && searchValue
          "
          :key="i"
        >
          <NuxtLink
            :to="'/' + story.full_slug"
          >
            {{ story.name }}
          </NuxtLink>
        </li>

I hope this provides enough information. Thank you!

about 4 years ago · Juan Pablo Isaza
1 Respostas
Responde à pergunta

0

Reference to vuejs docs:

For languages that require an IME (Chinese, Japanese, Korean, etc.), you’ll notice that v-model doesn’t get updated during IME composition. If you want to cater to these updates as well, use the input event instead.

Maybe it's because the type of your keyboard. But if it does not work in all keyboard, try using value and @input instead of v-model:

<input
   :value="searchValue"
   type="text"
   @input="filterStories"
/>

And in filterStory method:

filterStories(e) {
      this.searchValue = e.target.value
      if (this.stories.length) {
        let filtered = this.stories.filter(
          (story) =>
            story.name.toLowerCase().includes(this.searchValue.toLowerCase())
        )

        if (!this.searchValue) {
          this.filteredStories = []
        } else {
          this.filteredStories = filtered
        }
      }
}
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