-
Notifications
You must be signed in to change notification settings - Fork 1
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
Showing
2 changed files
with
88 additions
and
1 deletion.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,79 @@ | ||
<template> | ||
<div> | ||
<v-sheet | ||
tile | ||
height="35px" | ||
color="grey lighten-3" | ||
class="d-flex align-center" | ||
> | ||
<v-btn outlined small class="ma-4" @click="setToday">今日</v-btn> | ||
<v-btn icon @click="$refs.calendar.prev()"> | ||
<v-icon>mdi-chevron-left</v-icon> | ||
</v-btn> | ||
<v-btn icon @click="$refs.calendar.next()"> | ||
<v-icon>mdi-chevron-right</v-icon> | ||
</v-btn> | ||
<v-toolbar-title>{{ title }}</v-toolbar-title> | ||
</v-sheet> | ||
<v-sheet height="550px"> | ||
<v-calendar | ||
ref="calendar" | ||
v-model="value" | ||
:events="events" | ||
:event-color="getEventColor" | ||
locale="ja-jp" | ||
:day-format="(timestamp) => new Date(timestamp.date).getDate()" | ||
:month-format=" | ||
(timestamp) => new Date(timestamp.date).getMonth() + 1 + ' /' | ||
" | ||
@change="getEvents" | ||
></v-calendar> | ||
</v-sheet> | ||
</div> | ||
</template> | ||
|
||
<script> | ||
export default { | ||
props: { | ||
menus: { | ||
type: Array, | ||
required: true, | ||
}, | ||
}, | ||
data() { | ||
return { | ||
events: [], | ||
value: this.$dayjs().format("YYYY-MM-DD"), | ||
} | ||
}, | ||
computed: { | ||
title() { | ||
return this.$dayjs(this.value).format("YYYY年M月") | ||
}, | ||
}, | ||
methods: { | ||
getEvents() { | ||
const events = [] | ||
this.menus.forEach((f) => { | ||
let menu = { | ||
name: f.timezone, | ||
start: f.date, | ||
end: f.date, | ||
color: "blue", | ||
timed: false, | ||
} | ||
events.push(menu) | ||
}) | ||
this.events = events | ||
}, | ||
getEventColor(event) { | ||
return event.color | ||
}, | ||
setToday() { | ||
this.value = this.$dayjs().format("YYYY-MM-DD") | ||
}, | ||
}, | ||
} | ||
</script> | ||
|
||
<style scoped></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