When attempting to use this.$refs.calendars.$refs.calendar.showPageRange() in JavaScript, it works fine. However, when trying to implement it in TypeScript, an error occurs: '$refs' does not exist on type 'Vue | Element | Vue[] | Element[]'.
<v-date-picker
v-model="dates"
ref="calendars"
/>
TypeScript Code:
interface Data {
dates?: { start: Date; end: Date };
}
export default Vue.extend({
components: {
VDatePicker: () => import('v-calendar/lib/components/date-picker.umd')
},
data(): Data {
return {
dates: undefined
};
},
Error Occurrence in Methods:
this.$refs.calendars.$refs.calendar.showPageRange({
from: this.dates.end
})
An error saying "Property '$refs' does not exist on type 'Vue | Element | Vue[] | Element[]'" is displayed.