-
Notifications
You must be signed in to change notification settings - Fork 49
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
ac57ca8
commit 89488ed
Showing
6 changed files
with
95 additions
and
99 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,24 +1,97 @@ | ||
|
||
<template> | ||
<fullcalendar></fullcalendar> | ||
<div class='demo-app'> | ||
<FullCalendar | ||
class='demo-app-calendar' | ||
ref="fullCalendar" | ||
defaultView="dayGridMonth" | ||
locale="zh-cn" | ||
:header="{ | ||
left: 'prev,next today', | ||
center: 'title', | ||
right: 'dayGridMonth,timeGridWeek,timeGridDay,listWeek' | ||
}" | ||
:buttonText="buttonText" | ||
:plugins="calendarPlugins" | ||
:weekends="calendarWeekends" | ||
:events="calendarEvents" | ||
:eventLimit="true" | ||
eventLimitText="更多" | ||
@dateClick="handleDateClick" | ||
@eventClick="handleEventClick" | ||
/> | ||
</div> | ||
</template> | ||
|
||
<script> | ||
import Fullcalendar from '_c/fullcalendar/fullcalendar' | ||
import FullCalendar from '@fullcalendar/vue' | ||
import dayGridPlugin from '@fullcalendar/daygrid' | ||
import timeGridPlugin from '@fullcalendar/timegrid' | ||
import interactionPlugin from '@fullcalendar/interaction' | ||
export default { | ||
name: 'fullcalendar_page', | ||
components: { Fullcalendar }, | ||
components: { | ||
FullCalendar // make the <FullCalendar> tag available | ||
}, | ||
data () { | ||
return { | ||
buttonText: { | ||
today: '今天', | ||
month: '月', | ||
week: '周', | ||
day: '天', | ||
list: '列表' | ||
}, | ||
calendarPlugins: [ // plugins must be defined in the JS | ||
dayGridPlugin, | ||
timeGridPlugin, | ||
interactionPlugin // needed for dateClick | ||
], | ||
calendarWeekends: true, | ||
calendarEvents: [ // initial event data | ||
{ | ||
title: 'Event Now', | ||
start: new Date(), | ||
color: '#A61000' | ||
} | ||
] | ||
} | ||
}, | ||
created () { | ||
}, | ||
mounted () { | ||
methods: { | ||
toggleWeekends () { | ||
this.calendarWeekends = !this.calendarWeekends // update a property | ||
}, | ||
gotoPast () { | ||
let calendarApi = this.$refs.fullCalendar.getApi() // from the ref="..." | ||
calendarApi.gotoDate('2019-08-01') // call a method on the Calendar object | ||
}, | ||
handleDateClick (arg) { | ||
if (confirm('Would you like to add an event to ' + arg.dateStr + ' ?')) { | ||
this.calendarEvents.push({ // add new event data | ||
title: 'New Event', | ||
start: arg.date, | ||
allDay: arg.allDay | ||
}) | ||
} | ||
}, | ||
handleEventClick (info) { | ||
alert('Event: ' + info.event.title) | ||
} | ||
} | ||
} | ||
</script> | ||
|
||
<style lang='less'> | ||
// you must include each plugins' css | ||
// paths prefixed with ~ signify node_modules | ||
@import '~@fullcalendar/core/main.css'; | ||
@import '~@fullcalendar/daygrid/main.css'; | ||
@import '~@fullcalendar/timegrid/main.css'; | ||
.demo-app { | ||
font-family: Arial, Helvetica Neue, Helvetica, sans-serif; | ||
font-size: 14px; | ||
} | ||
.demo-app-calendar { | ||
margin: 0 auto; | ||
max-width: 900px; | ||
} | ||
</style> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters