[英]ToastUI Calendar Dependency requirement
I was trying to work with Toast UI calendar available here: https://github.com/nhn/tui.calendar I tried to use it via CDN which requires us to insert the following:我正在尝试使用此处提供的 Toast UI 日历: https://github.com/nhn/tui.calendar我尝试通过 CDN 使用它,这需要我们插入以下内容:
<link rel="stylesheet" type="text/css" href="https://uicdn.toast.com/tui-calendar/latest/tui-calendar.css" />
<!-- If you use the default popups, use this. -->
<link rel="stylesheet" type="text/css" href="https://uicdn.toast.com/tui.date-picker/latest/tui-date-picker.css" />
<link rel="stylesheet" type="text/css" href="https://uicdn.toast.com/tui.time-picker/latest/tui-time-picker.css" />
<script src="https://uicdn.toast.com/tui.code-snippet/latest/tui-code-snippet.js"></script>
<script src="https://uicdn.toast.com/tui.dom/v3.0.0/tui-dom.js"></script>
<script src="https://uicdn.toast.com/tui.time-picker/latest/tui-time-picker.min.js"></script>
<script src="https://uicdn.toast.com/tui.date-picker/latest/tui-date-picker.min.js"></script>
<script src="https://uicdn.toast.com/tui-calendar/latest/tui-calendar.js"></script>
When I tried to create a calendar in my html file, I noticed that it lacked a few functions such as date-picker, render-range, or even the event scheduler pop-up.当我尝试在我的 html 文件中创建日历时,我注意到它缺少一些功能,例如日期选择器、渲染范围,甚至是事件调度程序弹出窗口。 I also noticed that they talk of tui-code-snippet as a dependency for this calendar: https://github.com/nhn/tui.calendar#-dependency However, I'm not sure what to include from the tui-code-snippet exactly, as there are a bunch of functions in there and they state that we should only import the functions we need from it: https://github.com/nhn/tui.code-snippet#-usage我还注意到他们将 tui-code-snippet 作为此日历的依赖项: https://github.com/nhn/tui.calendar#-dependency但是,我不确定从 tui-code 中包含什么-snippet 确切地说,因为那里有一堆函数,它们 state 我们应该只从中导入我们需要的函数: https://github.com/nhn/tui.code-snippet#-usage
Any help in this would be greatly appreciated.对此的任何帮助将不胜感激。
EDIT : I added the following tui-code-snippet file as well, and this only helped me to get the calendar to show/render, but all the functionalities are still missing:编辑:我还添加了以下 tui-code-snippet 文件,这仅帮助我让日历显示/渲染,但仍然缺少所有功能:
<script src="https://uicdn.toast.com/tui.code-snippet/latest/tui-code-snippet.js"></script>
The code lacks a few js links such as:该代码缺少一些js链接,例如:
<script src="https://code.jquery.com/jquery-3.2.1.slim.min.js" integrity="sha384-KJ3o2DKtIkvYIK3UENzmM7KCkRr/rE9/Qpg6aAZGJwFDMVNA/GpGFF93hXpG5KkN"
crossorigin="anonymous"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/moment.js/2.20.1/moment.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/chance/1.0.13/chance.min.js"></script>
Once these links are attached, we simply need to create a tui.calendar
instance and then post the custom options as required.附加这些链接后,我们只需创建一个tui.calendar
实例,然后根据需要发布自定义选项。 An example of such can be:一个例子可以是:
<script type="text/javascript">
var cal, resizeThrottled;
var useCreationPopup = true;
var useDetailPopup = true;
var datePicker, selectedCalendar;
cal = new tui.Calendar('#calendar', {
defaultView: 'week',
useCreationPopup: useCreationPopup,
useDetailPopup: useDetailPopup,
calendars: CalendarList,
template: {
milestone: function(model) {
return '<span class="calendar-font-icon ic-milestone-b"></span> <span style="background-color: ' + model.bgColor + '">' + model.title + '</span>';
},
allday: function(schedule) {
return getTimeTemplate(schedule, true);
},
time: function(schedule) {
return getTimeTemplate(schedule, false);
}
}
});
</script>
and it should load the calendar just fine, and allow adding events to the scheduler.它应该可以很好地加载日历,并允许将事件添加到调度程序。 I hope this helps anyone else stuck in a similar problem.我希望这可以帮助其他陷入类似问题的人。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.