问题
I installed rrule
plugin by running:
npm install @fullcalendar/rrule
but when I add its import to my component:
import dayGridPlugin from '@fullcalendar/daygrid';
import timeGridPlugin from '@fullcalendar/timegrid';
import interactionPlugin from '@fullcalendar/interaction';
import rrulePlugin from '@fullcalendar/rrule'; //error appears after adding this import
I get this errors:
node_modules/@fullcalendar/common/vdom.d.ts:16:28 - error TS2304: Cannot find name 'FullCalendarVDom'.
16 export import flushToDom = FullCalendarVDom.flushToDom;
~~~~~~~~~~~~~~~~
node_modules/@fullcalendar/common/vdom.d.ts:16:28 - error TS2503: Cannot find namespace 'FullCalendarVDom'.
16 export import flushToDom = FullCalendarVDom.flushToDom;
Other plugin imports are working fine. Where is the problem?
回答1:
In case it's useful for anyone, here's what worked for me.
(Edit: I'm obviously using PrimeNG with Angular...)
In the xyz.component.html
file:
<p-fullCalendar #calendar ...></p-fullCalendar>
In the xyz.component.ts
file:
import {FullCalendar} from 'primeng/fullcalendar';
...
@ViewChild('calendar') private calendar: FullCalendar;
Didn't need to use the calendar
field for anything, but this hack seems to get the imports in the right order. For some reason. Go figure.
来源:https://stackoverflow.com/questions/63037718/angular-9-cannot-find-namespace-fullcalendarvdom