В настоящее время я помогаю другу с его веб-сайтом Wix установить fullCalendar. Пакет NPM был установлен через диспетчер пакетов Corvid.
Затем я создал пользовательский элемент в Corvid с приведенным ниже кодом в файле JavaScript для этого пользовательского элемента, который имеет тег wix-calendar. РЕДАКТИРОВАТЬ. Как и было предложено, я обновил код, который теперь показывает ошибку вместе с журналами консоли.
См. часть 1 (код) и часть 2 (вывод) ниже.
Часть 1: js, связанный с пользовательским html-компонентом wix:
import { React } from "react";
import { Calendar } from "fullcalendar";
import { jquery } from "jquery";
import dayGridPlugin from "@fullcalendar/daygrid";
const DEBUG_TEXT = '1-class definitions callback';
const DEBUG_TEXT2 = '2-render function called';
const calendarContainer = document.createElement('div');
console.log("here we go");
class WixFullCalendar extends HTMLElement {
constructor() {
super();
console.log(DEBUG_TEXT);
}
connectedCallback() {
const calendarEl = document.createElement('div');
calendarEl.setAttribute('id', 'calendar');
console.log(calendarEl);
const calendar = new Calendar(calendarEl, {
plugins: [ dayGridPlugin ]
});
console.log(DEBUG_TEXT2)
calendar.render();
}
}
customElements.define('wix-calendar', WixFullCalendar);
Часть 2: консольный вывод
here we go wix-calendar.js:14
1-class definitions callback wix-calendar.js:20
<div id="calendar"></div> wix-calendar.js:29
2-render function called fullcalendar.js:10807
<div id="calendar"></div>
> Uncaught TypeError: el.addClass is not a function
> at Calendar.initialRender (fullcalendar.js:10807)
> at Calendar.render (fullcalendar.js:10796)
> at HTMLElement.connectedCallback (wix-calendar.js:30)
> at Object.12.@fullcalendar/daygrid (wix-calendar.js:34)
> at o (_prelude.js:1)
> at r (_prelude.js:1)
> at _prelude.js:1
> at _prelude.js:1
> at _prelude.js:1 Calendar.initialRender @ fullcalendar.js:10800 Calendar.render @ fullcalendar.js:10794 connectedCallback @
> wix-calendar.js:30
> 12.@fullcalendar/daygrid @ wix-calendar.js:34 o @ _prelude.js:1 r @ _prelude.js:1 (anonymous) @ _prelude.js:1 (anonymous) @ _prelude.js:1 (anonymous) @ _prelude.js:1