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

229
Views
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
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!