Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

108
Vistas
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 Respuestas
Responde la pregunta

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 Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda