【发布时间】:2019-02-26 19:16:26
【问题描述】:
我有一个可以根据 type 属性更改的工作日历。我可以在日历标题中显示信息,但日间事件似乎是个问题。
我的 vue.js vuetify 日历不显示日事件。它设置为显示为“周”类型。我在以下example工作。
export default {
data: () => ({
todayDate: new Date().toISOString().substr(0, 10) /*'YYYY-MM-DD'*/ ,
type: 'week',
events: [{
title: 'Weekly Meeting',
date: '2019-02-26',
time: '09:00',
duration: 45
},
{
title: 'Mash Potatoes',
date: '2019-02-28',
time: '12:30',
duration: 180
}
]
}),
computed: {
eventsMap() {
const map = {};
this.events.forEach(e => (map[e.date] = map[e.date] || []).push(e));
return map
}
}
}
</script>
<v-calendar ref="calendar" :type="type" v-model="todayDate" :now="todayDate" :value="todayDate" color="primary">
<template slot="dayBody" slot-scope="{ date, timeToY, minutesToPixels }">
<template v-for="event in eventsMap[date]">
<div
v-if="event.time"
:key="event.title"
v-html="event.title"
></div>
</template>
</template>
</v-calendar>
【问题讨论】:
-
你修好了吗?
-
我在这里找到了解决方案:stackoverflow.com/questions/55649765/…
标签: vue.js vuetify.js