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

119
Vistas
v-calendar datepicker stop date from being deselected

Once a date has been selected, is there a way to stop the date being deselected if the same date is clicked again? I thought by setting the date in the day clicked event it would stop the deselection, but it doesn't - is there a way to do so?

new Vue({
  el: "#app",
  data() {
    return {
      date: new Date(),
      masks: {
        input: 'DD/MM/YYYY',
      },
    };
  },
  methods: {
    dayClicked(day) {
      this.date = new Date(day.id);
    },
  },
});
@import url 'https://unpkg.com/v-calendar@2.3.4/lib/v-calendar.min.css';
<script src="https://unpkg.com/vue@2.6.14/dist/vue.js"></script>
<script src="https://unpkg.com/v-calendar@2.3.4/lib/v-calendar.umd.min.js"></script>
<div id='app'>
  <v-date-picker v-model="date" color="orange" :masks="masks" :disabled-dates="{ weekdays: [1, 7] }" @dayclick="dayClicked">
    <template #default="{ inputValue, togglePopover }">
        <label class="form__label date-selector__label" @click="togglePopover">
          <span class="form__label-text date-selector__label-text">Date</span>
          <span class="date-selector__label-value">{{ inputValue }}</span>
        </label>
      </template>
  </v-date-picker>
</div>

about 4 years ago · Juan Pablo Isaza
1 Respuestas
Responde la pregunta

0

Turns out there is an :is-required attribute you can set to true if you don't want the date to be cleared:

new Vue({
  el: "#app",
  data() {
    return {
      date: new Date(),
      masks: {
        input: 'DD/MM/YYYY',
      },
    };
  },
  methods: {
    dayClicked(day) {
      this.date = new Date(day.id);
    },
  },
});
@import url 'https://unpkg.com/v-calendar@2.3.4/lib/v-calendar.min.css';
<script src="https://unpkg.com/vue@2.6.14/dist/vue.js"></script>
<script src="https://unpkg.com/v-calendar@2.3.4/lib/v-calendar.umd.min.js"></script>
<div id='app'>
  <v-date-picker v-model="date" color="orange" :masks="masks" :disabled-dates="{ weekdays: [1, 7] }" :is-required="true" @dayclick="dayClicked">
    <template #default="{ inputValue, togglePopover }">
        <label class="form__label date-selector__label" @click="togglePopover">
          <span class="form__label-text date-selector__label-text">Date</span>
          <span class="date-selector__label-value">{{ inputValue }}</span>
        </label>
      </template>
  </v-date-picker>
</div>

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