I have the following in my code...
<template>
<DatePicker v-model="selectedDate" @input="dateChanged">
<template v-slot="{ inputValue, inputEvents }">
<input
:value="inputValue"
v-on="inputEvents"
/>
</template>
</DatePicker>
<h2>{{selectedDate}}</h2>
<h2>{{date}}</h2>
</template>
<script>
import { DatePicker } from "v-calendar";
export default {
components: { DatePicker },
data() {
return {
selectedDate: Date.now(),
};
},
mounted() {
this.selectedDate = this.date;
},
props: {
date: {
type: Number,
default: Date.now(),
}
},
methods: {
dateChanged() {
console.log(`The date changed to`);
},
},
};
</script>
The problem is that dateChanged
never gets called. I also tried @changed="dateChanged"
but either way I don't see the log message in the browser. How do I get the change event when a new date is picked?