<template>
<VueDatePicker v-model="date" ref="datepicker" />
</template>
<script setup>
import { ref } from 'vue';
const date = ref();
const datepicker = ref(null);
const yourCustomMethod = () => {
if (datepicker) {
// Close the menu programmatically
datepicker.value.closeMenu()
}
}
</script>
I’m trying to customize the VueDatePicker with the implementation mentioned above, but I get an error saying that closeMenu() does not exist in type ‘never’. I followed the implementation according to the VueDatePicker documentation, so I can’t figure out where the problem is.
I want to solve this issue.
2
Answers
Hey you can do something like this.
OR
you can maybe juste add this condition :
I tried to reproduce your problem here https://codesandbox.io/s/blissful-ully-qg6xpo?file=/src/App.vue, but everything works fine