Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

234
Views
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 answers
Answer question

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 Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!