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

224
Vistas
attemp to trigger @onChange results in : this.$emit is not a function

What I am attempting:

when a button is clicked, a js function passes a value to a vue method and triggers the events attached to the method.

my js file:

function StartDate(){

    DatePicker.methods.dateInput(moment(new Date()).format(moment.HTML5_FMT.DATE))
}
window.updateStartDate = updateStartDate;

Button.addEventListener('click', function () {
            StartDate()
        });

my .vue file :

    <template>
            <vue-date-picker
                v-model="date"
                format="DD/MM/YYYY"
                @input="dateInput(date)"
                @onChange="dateInput(date)"
                v-bind:name="name"
            >
            </vue-date-picker>
    </template>
<script>
        props: {
            name: {
                type: String,
                default: 'ChangeMe',
            },
            value: {
                type: String,
                default: (moment().format(moment.HTML5_FMT.DATE)),
            },
        },
        data: () => ({
            date: moment(new Date()).format(moment.HTML5_FMT.DATE),
        }),
        methods: {
            dateInput(value) {
                this.$emit('input', value);
                this.$emit('change');
            }
        },
     
    }
</script>

When i console log inside my method I can see i've successfully passed in the date I want however instead of changing the value or triggering an onchange/on input event, I receive this error:

this.$emit is not a function

about 4 years ago · Juan Pablo Isaza
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