1:安装
npm i fullcalendar -S
2:引入
import fullcalendar from "fullcalendar";
import "fullcalendar/dist/fullcalendar.min.css";
import "fullcalendar/dist/locale/zh-cn.js";(中文包)
3:使用
$("#calendar").fullCalendar({
header: { left: "prev,next today", center: "title", right: "month,basicWeek" },
navLinks: true, // can click day/week names to navigate views
editable: true,
eventLimit: true, // allow "more" link when too many events
eventLimitText: "更多",
events: [ { title: "All Day Event", start: "2018-11-01", color: "#06BB87" }, ] });
4:注意事项
4.1依赖moment.js/jquery.js。
4.2渲染前需要在html中设置一个容器,本文是#calendar。