如何解决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 举报,一经查实,本站将立刻删除。