-
Notifications
You must be signed in to change notification settings - Fork 0
/
calendarToolbar.vue
59 lines (57 loc) · 1.4 KB
/
calendarToolbar.vue
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
<template>
<div class="mu-calendar-toolbar">
<mu-icon-button :disabled="!prevMonth" @click.stop="prev">
<svg viewBox="0 0 24 24" class="mu-calendar-svg-icon">
<path d="M15.41 7.41L14 6l-6 6 6 6 1.41-1.41L10.83 12z"/>
</svg>
</mu-icon-button>
<div class="mu-calendar-toolbar-title-wrapper">
<transition :name="'mu-calendar-slide-' + slideType" v-for="(displayDate, index) in displayDates" :key="index">
<div class="mu-calendar-toolbar-title" :key="displayDate.getTime()">
{{dateTimeFormat.formatMonth(displayDate)}}
</div>
</transition>
</div>
<mu-icon-button :disabled="!nextMonth" @click.stop="next">
<svg viewBox="0 0 24 24" class="mu-calendar-svg-icon">
<path d="M10 6L8.59 7.41 13.17 12l-4.58 4.59L10 18l6-6z"/>
</svg>
</mu-icon-button>
</div>
</template>
<script>
import * as dateUtils from '../../../es/dateUtils';
export default {
name: 'calendarToolbar',
props: {
dateTimeFormat: {
type: Object,
default() {
return dateUtils.dateTimeFormat;
},
},
displayDates: {
type: Array,
},
nextMonth: {
type: Boolean,
default: true,
},
prevMonth: {
type: Boolean,
default: true,
},
slideType: {
type: String,
},
},
methods: {
prev() {
this.$emit('monthChange', -1);
},
next() {
this.$emit('monthChange', 1);
},
},
};
</script>