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

98
Views
how to activated click event on autocomplete search bar vue with router link

I have an app that is a github clone. I want to make search bar work like github. But my search bar on navbar on option section does want to click. I have give the option a event but still does not work. here my code

data() {
    return {
      search: "",
      filteredrepo: [],
      owner: "dimaswntech",
    };
  },
  methods: {
    toRoute() {
      console.log("klilk", this.search);
      this.$router.push({ path: "/detail/" + this.search });
    },
<b-nav-form>
            <input
              class="form-control input-repo"
              type="text"
              v-model="search"
              @input="searchData"
              autocomplete="off"
              list="my-list-id"
              placeholder="Search repo"
            />
            <datalist id="my-list-id" v-if="filteredrepo" @change="toRoute">
              <option v-for="filterre in filteredrepo" :key="filterre.id">
                {{ filterre.name }}
              </option>
            </datalist>
            <!-- <b-button size="sm" class="my-2 my-sm-0" type="submit"
              >Search</b-button
            > -->
          </b-nav-form>

about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

v-model is the two-way binding method of vue. Its equal to v-bind:value combined with @input. I would remove the @input

<input
  :value="text"
  @input="event => text = event.target.value">
<input v-model="text">

Then you search data should include the value of your searchbar and you have to fire the toRoute method afterwards.

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!