Skip to content
On this page

Methods

List of available methods that you can call on the datepicker from the external code

Add a ref to the component, and call the method on that ref

Code Example
vue
<template>
    <Datepicker v-model="date" ref="datepicker" />
</template>

<script>
import { ref } from 'vue';

export default {
    setup() {
        const date = ref();
        const datepicker = ref(null);

        const yourCustomMethod = () => {
          if (datepicker) {
            // Close the menu programmatically
            datepicker.value.closeMenu()
          }
        }
        
        return {
          date,
        }
    }
}
</script>

selectDate

When called and there is an active selection, it will select that date.

closeMenu

Closes the datepicker menu

openMenu

Opens the datepicker menu

clearValue

Clears the selected value

updateInternalModelValue

  • Parameter: Date | Date[]

Modify the internal model-value while the picker is in the open state.

setMonthYear

  • Parameter: { month?: number | string; year?: number | string; }

Set calendar month and year programmatically

onScroll

Manually trigger method that is called on window scroll

Released under the MIT License.