Salesforce LWC FullCalendar V5初始化问题

问题描述

在Salesforce Lightning Web组件中初始化V5.3.2 FullCalendar时遇到问题:

JS:

import { loadStyle,loadScript } from 'lightning/platformResourceLoader';

import fullCalendar from '@salesforce/resourceUrl/fullCalendar532';
// import fullCalendar from '@salesforce/resourceUrl/fullCalendar442';


export default class FullCalendarTestV5 extends LightningElement 
{
    async renderedCallback()
    {
        console.log(`## loading up calendar library...`);
        await Promise.all([
            loadScript(this,fullCalendar + '/lib/main.js'),loadStyle(this,fullCalendar + '/lib/main.css')

            // loadScript(this,fullCalendar + '/packages/core/main.js'),// loadStyle(this,fullCalendar + '/packages/core/main.css')
        ]).catch(error => {
            console.error(`## error: ${error}`);
        });

        console.log(`## loaded up calendar library...`);

        this.initialiseFullCalendarJs();

        

    }

    initialiseFullCalendarJs()
    {
        
        console.log(`## initializing calendar...`);

        const ele = this.template.querySelector("div.fullcalendarjs");

        console.log(`## ele: ${ele}`);

        let calendar = new FullCalendar.Calendar(ele,{});
        // calendar.render();
    }
}```

HMTL:

```<template>
    Full Calendar

    <lightning-card>
        <div id="calendar" class="fullcalendarjs slds-p-horizontal_small"></div>
    </lightning-card>
    
</template>

错误

fullCalendarTestV5.js:4未捕获(已承诺)ReferenceError:未定义FullCalendar 在s.initialiseFullCalendarJs(fullCalendarTestV5.js:4) 在s.renderedCallback(fullCalendarTestV5.js:4)

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)