【发布时间】:2021-04-29 13:19:13
【问题描述】:
我正在尝试创建一个利用 FullCalendar vue 组件的 vue 组件:
<script>
import FullCalendar from '@fullcalendar/core'
import interactionPlugin from '@fullcalendar/interaction'
import dayGridPlugin from '@fullcalendar/daygrid'
export default {
components: {
FullCalendar
},
data: function() {
return {
calendarOptions: {
plugins: [ dayGridPlugin, interactionPlugin ],
initialView: 'dayGridMonth',
events: '/schedule/month_events',
eventOrder: "building_id",
selectable: true,
defaultAllDay: true,
editable: true,
dateClick: this.handleDateClick,
headerToolbar: {
left: '',
center: 'title',
right: 'prev today next'
}
}
}
},
methods: {
handleDateClick: function(arg) {
console.log('test');
}
}
}
</script>
<template>
<FullCalendar :config="calendarOptions" />
</template>
<style scoped>
</style>
我收到以下错误:
[Vue warn]: Unknown custom element: <FullCalendar> - did you register the component correctly? For recursive components, make sure to provide the "name" option.
如果我创建自己的组件,它会显示模板并找到组件就好了。
如何在我的 Vue JS 组件中正确使用 FullCalendar 组件?
【问题讨论】:
-
如果我查看docs,您需要使用
@fullcalendar/vue,您正在使用@fullcalendar/core
标签: vue.js fullcalendar fullcalendar-5