salesforce - 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 Uncaught (in promise) ReferenceError: FullCalendar is not defined at s.initialiseFullCalendarJs (fullCalendarTestV5.js:4) at s.renderedCallback (fullCalendarTestV5.js:4)
解决方案
推荐阅读
- python - 如何将 Ipykernel 降级到版本。4.10
- html - 如何使用角度材料或角度制作图像中给出的底栏?
- web-services - 使用 Oracle SOA 套件调用 REST API
- java - 如何解决:IllegalStateException:您需要在此活动中使用 Theme.AppCompat 主题(或后代)
- java - 如何设置对 Set 不区分大小写
- android-layout - Android TextView中的Unicode字体颜色?
- git - 变基/合并时出现“创作和提交”问题的 Git 问题
- excel - 有没有办法将 Control F bar 选项的外观设置为值而不是公式?
- python-3.x - 带有循环功能/密码退出的Python3?
- acumatica - 使用不同视图将选项卡和网格同步到同一个主 DAC