我尝试在 Blazor webassembly 页面中使用 FullCalendar。任何人都知道如何在 Blazor 中使用 FullCalendar ??? 任何人都可以帮助我吗?
我在 libman.json 中包含 FullCalendar
{
"library": "@fullcalendar/core",
"provider": "unpkg",
"destination": "wwwroot/lib/fullCalendar"
}
在 wwwroot/index.html
<script src="_framework/blazor.webassembly.js"></script>
<script src="exampleJsInterop.js"></script>
wwwroot文件夹中的我的js文件“exampleJsInterop.js”
window.exampleJsFunctions = {
showPrompt: function (text) {
return prompt(text, 'Type your name here');
},
displayWelcome: function (welcomeMessage) {
document.getElementById('welcome').innerText = welcomeMessage;
},
calendar: function () {
document.getElementById("#calendar").fullCalendar({
schedulerLicenseKey: 'GPL-My-Project-Is-Open-Source',
editable: false,
allDaySlot: true,
eventLimit: true,
axisFormat: 'HH:mm',
slotLabelFormat: 'HH:mm',
aspectRatio: 2,
header: {
left: 'today prev,next',
center: 'title',
right: 'month '
},
//defaultView: 'timelineDay',
selectable: true,
});
}
};
剃刀页面
@page "/fullCalendar"
@inject IJSRuntime JsRuntime;
<h1>FullCalendar</h1>
<button type="button" class="btn btn-primary" @onclick="test">
Bouton test
</button>
<div class="container">
<div id='calendar'></div>
</div>
@code {
private async void test() {
await JsRuntime.InvokeVoidAsync("exampleJsFunctions.calendar");
}
}
代码有什么问题?
错误 :
(Microsoft.JSInterop.JSException: $ is not** defined)
>main.js:1
Failed to load resource: the server responded with a status of 404 (Not Found)
blazor.webassembly.js:1 Debugging hotkey: Shift+Alt+D (when application has focus)
favicon.ico:1 Failed to load resource: the server responded with a status of 404 (Not Found)
blazor.webassembly.js:1 WASM:
d.printErr @ blazor.webassembly.js:1
put_char @ mono.js:1
write @ mono.js:1
write @ mono.js:1
doWritev @ mono.js:1
___syscall146 @ mono.js:1
Module._mono_background_exec @ mono.js:1
pump_message @ mono.js:1
setTimeout (async)
_schedule_background_exec @ mono.js:1
Module._mono_wasm_invoke_method @ mono.js:1
callMethod @ blazor.webassembly.js:1
beginInvokeDotNetFromJS @ blazor.webassembly.js:1
l @ blazor.webassembly.js:1
e.invokeMethodAsync @ blazor.webassembly.js:1
(anonymous) @ blazor.webassembly.js:1
t.dispatchEvent @ blazor.webassembly.js:1
(anonymous) @ blazor.webassembly.js:1
(anonymous) @ blazor.webassembly.js:1
e.onGlobalEvent @ blazor.webassembly.js:1
Show 26 more frames
blazor.webassembly.js:1 WASM: Unhandled Exception:
d.printErr @ blazor.webassembly.js:1
put_char @ mono.js:1
write @ mono.js:1
write @ mono.js:1
doWritev @ mono.js:1
___syscall146 @ mono.js:1
Module._mono_background_exec @ mono.js:1
pump_message @ mono.js:1
setTimeout (async)
_schedule_background_exec @ mono.js:1
Module._mono_wasm_invoke_method @ mono.js:1
callMethod @ blazor.webassembly.js:1
beginInvokeDotNetFromJS @ blazor.webassembly.js:1
l @ blazor.webassembly.js:1
e.invokeMethodAsync @ blazor.webassembly.js:1
(anonymous) @ blazor.webassembly.js:1
t.dispatchEvent @ blazor.webassembly.js:1
(anonymous) @ blazor.webassembly.js:1
(anonymous) @ blazor.webassembly.js:1
e.onGlobalEvent @ blazor.webassembly.js:1
Show 26 more frames
**blazor.webassembly.js:1 WASM: Microsoft.JSInterop.JSException: $ is not** defined
d.printErr @ blazor.webassembly.js:1
put_char @ mono.js:1
write @ mono.js:1
write @ mono.js:1
doWritev @ mono.js:1
___syscall146 @ mono.js:1
Module._mono_background_exec @ mono.js:1
pump_message @ mono.js:1
setTimeout (async)
_schedule_background_exec @ mono.js:1
Module._mono_wasm_invoke_method @ mono.js:1
callMethod @ blazor.webassembly.js:1
beginInvokeDotNetFromJS @ blazor.webassembly.js:1
l @ blazor.webassembly.js:1
e.invokeMethodAsync @ blazor.webassembly.js:1
(anonymous) @ blazor.webassembly.js:1
t.dispatchEvent @ blazor.webassembly.js:1
(anonymous) @ blazor.webassembly.js:1
(anonymous) @ blazor.webassembly.js:1
e.onGlobalEvent @ blazor.webassembly.js:1
Show 26 more frames
blazor.webassembly.js:1 WASM: ReferenceError: $ is not defined
d.printErr @ blazor.webassembly.js:1
put_char @ mono.js:1
write @ mono.js:1
write @ mono.js:1
doWritev @ mono.js:1
___syscall146 @ mono.js:1
Module._mono_background_exec @ mono.js:1
pump_message @ mono.js:1
setTimeout (async)
_schedule_background_exec @ mono.js:1
Module._mono_wasm_invoke_method @ mono.js:1
callMethod @ blazor.webassembly.js:1
beginInvokeDotNetFromJS @ blazor.webassembly.js:1
l @ blazor.webassembly.js:1
e.invokeMethodAsync @ blazor.webassembly.js:1
(anonymous) @ blazor.webassembly.js:1
t.dispatchEvent @ blazor.webassembly.js:1
(anonymous) @ blazor.webassembly.js:1
(anonymous) @ blazor.webassembly.js:1
e.onGlobalEvent @ blazor.webassembly.js:1
Show 26 more frames
blazor.webassembly.js:1 WASM: at testDan (http://localhost:53863/:30:17)
d.printErr @ blazor.webassembly.js:1
put_char @ mono.js:1
write @ mono.js:1
write @ mono.js:1
doWritev @ mono.js:1
___syscall146 @ mono.js:1
Module._mono_background_exec @ mono.js:1
pump_message @ mono.js:1
setTimeout (async)
_schedule_background_exec @ mono.js:1