Skip to content

Instantly share code, notes, and snippets.

@luane-aquino
Last active March 5, 2025 09:01
Show Gist options
  • Save luane-aquino/3479b35c86f9bc2b29afc6824bd9736e to your computer and use it in GitHub Desktop.
Save luane-aquino/3479b35c86f9bc2b29afc6824bd9736e to your computer and use it in GitHub Desktop.
Vue component using v-calendar with a custom “Prev” and "Next" button in the header.
<!-- This code defines a Vue component that uses the v-calendar library to display a calendar with a custom "Prev" and "Next" button in the header -->
<script setup lang="ts">
const handleClickPrev = (props: any) => {
console.log('[handleClickPrev props]', props);
}
const handleClickNext = (props: any) => {
console.log('[handleClickNext props]', props);
}
</script>
<template>
<h1>Logs the slot props to the console when back/previous button is clicked</h1>
<div id="app">
<div class="container">
<VCalendar class="my-calendar">
<template #header-prev-button="props">
<button @click="handleClickPrev(props)">Prev</button>
</template>
<template #header-next-button="props">
<button @click="handleClickNext(props)">Next</button>
</template>
</VCalendar>
</div>
</div>
</template>
<style>
</style>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment