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

106
Views
vuejs: v-on does not trigger function

I have an input component that should call a method getUserSearch when the user types, and update the variable v_on_search with the variable v_model_search value.

I am displaying the content with the variables: v_model_search and v_on_search to test, although only the v-model seems to be working.


<template>
    <div>
        <input type="text" placeholder="search here" v-model="v_model_search" v-on:oninput="getUserSearch()">
        <p>{{v_model_search}}</p>
        <p>{{v_on_search}}</p>
    </div>
</template>

<script>
    export default {
        name: 'SearchBox',
        data () {
            return {
                v_model_search: '',
                v_on_search: ''
            }
        },
        methods: {
            getUserSearch ()
            {
                this.v_on_search = this.v_model_search
            }
        }
    }
</script>
about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

Try

v-on:input="getUserSearch()"

or shorter

@input="getUserSearch()"

Vue recognizes HTML events but they don't have the "on" prefix

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!