User2041008840 posted
site.js
window.fulcalendar = () => {
$(function () {
document.addEventListener('DOMContentLoaded', function () {
var calendarEl = document.getElementById('calendar');
var calendar = new FullCalendar.Calendar(calendarEl, {
initialView: 'dayGridMonth'
,
events: [
{
title: 'All Day Event',
start: '2020-09-01'
},
{
title: 'Long Event',
start: '2020-09-07',
end: '2020-09-10'
},
{
groupId: '999',
title: 'Repeating Event',
start: '2020-09-09T16:00:00'
},
{
groupId: '999',
title: 'Repeating Event',
start: '2020-09-16T16:00:00'
},
{
title: 'Conference',
start: '2020-09-11',
end: '2020-09-13'
},
{
title: 'Meeting',
start: '2020-09-12T10:30:00',
end: '2020-09-12T12:30:00'
},
{
title: 'Lunch',
start: '2020-09-12T12:00:00'
},
{
title: 'Meeting',
start: '2020-09-12T14:30:00'
},
{
title: 'Birthday Party',
start: '2020-09-13T07:00:00'
},
{
title: 'Click for Google',
url: 'http://google.com/',
start: '2020-09-28'
}
]
});
calendar.render();
});
});
};
index.razor
@page "/"
@inject IJSRuntime IJSRuntime
<h1>Hello, world!</h1>
Welcome to your new app.
<SurveyPrompt Title="How is Blazor working for you?" />
<div id="calendar">
</div>
@code
{ protected override async Task OnAfterRenderAsync(bool firstRender)
{
await IJSRuntime.InvokeVoidAsync("fulcalendar");
}
}
index.html
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no" />
<title>FullCalendarBlazor</title>
<base href="/" />
<link href="css/bootstrap/bootstrap.min.css" rel="stylesheet" />
<link href="/js/main.css" rel="stylesheet" />
<script src="/js/main.js"></script>
<link href="css/app.css" rel="stylesheet" />
</head>
<body>
<app>Loading...</app>
<div id="blazor-error-ui">
An unhandled error has occurred.
<a href="" class="reload">Reload</a>
<a class="dismiss"></a>
</div>
<script src="_framework/blazor.webassembly.js"></script>
<script src="/jquery/dist/jquery.js"></script>
<script src="/popper/popper.js"></script>
<script src="/bootstrap/dist/js/bootstrap.js"></script>
<script src="/js/site.js"></script>
</body>
</html>
I tried this code many time but its not working in Blazor wasm. in inspect element there is no error.