CroudTech / vue-fullcalendar

FullCalendar Wrapper for vue
MIT License
483 stars 100 forks source link

May I get the time when I change the display view? #141

Closed DivingPigy closed 6 years ago

DivingPigy commented 6 years ago

For example, I click the tag in a view, may I get the time-range after it? default

DivingPigy commented 6 years ago

I haven't pick up anything applicable or helpful in official docs. Seems so hard for me.

DivingPigy commented 6 years ago

Ahu, I get the time when the calendar-view is not changing. The process is bellow:

1) Set the ref property for calendar, using the ref to get it. <FullCalendar :events="events" :config="config" @event-selected="eventSelected" @day-click="dayClick" ref="calendar">

2) Get the calendar element, then print it in the console. console.log(this.$refs.calendar.fireMethod('getDate').format());

Notes: fireMethod is recommanded in the vue-demo.

Then I need to get the calendar-view params.

DivingPigy commented 6 years ago

Now, I achieved to get time start-end in my program phase.

Notes: the criticle poiont: View-object and his property should. Find them on the official docs.

DivingPigy commented 6 years ago

Sorry for forget the code phase:

console.log(this.$refs.calendar.fireMethod("getView").start.format()); console.log(this.$refs.calendar.fireMethod("getView").end.format());

DivingPigy commented 6 years ago

Check out this, using json feed to solve this problem. Json feed can do dynamic request for data to display, when calendar-view changing or you click the next or prev date-navigation link.

Notes: Items bellow may help you: 1) https://github.com/CroudTech/vue-fullcalendar#using-a-json-feed 2) https://github.com/CroudTech/vue-fullcalendar/issues/127

DivingPigy commented 6 years ago

I solve this problem! Fantastic is Github!