how to get currently selected month

60 views Asked by At

i use this lib npm install v-calendar@next @popperjs/core and i don't know how to get the value

i want current value selected to show information of the month

//.
//.
//.
//.
<script>
export default {
    data() {
        return {
            initialPage: ref([{ month: new Date().getMonth() + 1, year: new Date().getFullYear() }]),
            attributes: ref([
                {
                    dot: {
                        style: {
                            backgroundColor: '#DD2C00',
                        },
                    },
                    dates: [
                        // new Date(2023, 9, 12),
                        // new Date(2023, 3, 26),
                        // new Date(2023, 5, 15),
                        // new Date(2023, 6, 15),
                    ],
                },
            ]).
//.
//.```
1

There are 1 answers

2
quilkin On

This is working for me:

<template>
  <div class="text-center">
    <DatePicker  v-model="workingDate" @update:modelValue="newDate"/>
  </div>
</template>

and

const workingDate = ref(props.date);    
function newDate() {
     emit("newDate",workingDate.value);
}

Perhaps you need to show more of your code to show what you tried. But many thanks for alerting me to this plugin - I was using Vuetify Labs datepicker before and it was giving me problems. This looks better.

Sorry, I'm using the Vue compostion API, you'll need to adjust my script for your case