【问题标题】:Unknown custom element: <FullCalendar> - FullCalendar Vue未知的自定义元素:<FullCalendar> - FullCalendar Vue
【发布时间】: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


【解决方案1】:

由于您使用的是 Vue 组件,因此您需要从@fullcalendar/vue 导入。您目前正在从@fullcalendar/core 导入。

【讨论】:

  • 拍前额 谢谢,看来已经奏效了。现在出现新错误:)
  • 嗨,Harsal,你能检查我的问题吗?谢谢。 stackoverflow.com/questions/67384812/…
  • Harshal,我将发布另一个关于使用 FullCalendar Vue 组件添加事件的问题。
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 2020-04-05
  • 2018-02-06
  • 2017-12-22
  • 2018-02-08
  • 2020-03-28
  • 2019-02-03
  • 2011-02-06
相关资源
最近更新 更多