Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

244
Visualizações
Vue datetime v-on:input being triggered on initial load

I have a datetime picker below. When the component is mounted initially, the changeDate method is being fired.

I've removed any other reference to this method so it's definitely being caused by the code below.

Does anyone know what's going on here? There is no user input so this shouldn't be getting triggered.

Can the v-model attribute not be used together with v-on:input?

<datetime
  ref="datimepicker"
  v-model="meeting.due_date"
  v-on:input="changeDate(meeting.due_date)"
/>

I've replicated the issue here - https://codepen.io/s89_/pen/QWOrzbv

about 4 years ago · Juan Pablo Isaza
2 Respostas
Responde à pergunta

0

On further inspection, this seems to be an actual issue with the package which appears is no longer maintained - https://github.com/mariomka/vue-datetime/issues/272

I suppose a possible way around this is just to place a watcher on the v-model value and emit the changeDate event from there.

about 4 years ago · Juan Pablo Isaza Relatório

0

You can see in the source code that for Datetime.vue

created () {
    this.emitInput()
},

It calls emitInput

emitInput () {
    let datetime = this.datetime ? this.datetime.setZone(this.valueZone) : null
    if (datetime && this.type === 'date') {
        datetime = startOfDay(datetime)
    }
    this.$emit('input', datetime ? datetime.toISO() : '')
},

If you want to get around this, I would check that the passed in value from the event doesn't equal to what meeting.due_date currently is.

You could do something like this.

about 4 years ago · Juan Pablo Isaza Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda