Fullcanlendar周视图设置全天单元行的内容数量

兄弟们,今天遇到了这个需求,大致就是Fullcanlendar周视图,仅显示全天(OK这个还挺好整,用css display:none,把下面时间的给梭哈去掉)

	calendarOptions: {
				plugins: [
					timeGridPlugin,
				],
				height: 400,//再给老表一个这个高度,这不就ok了吗

}

我还挺聪明,想着弄完了,摸摸鱼吧,然后上线发现,之前数据量不够多,导致有个问题

如图

给我整无语了,好吧,查那恶心的文档

首先是这个参数,就不翻译啥的了,直接嚼碎,意思就是超过了内容宽度就显示more 更多选项,

好了,我反手给你关了

运行

有点感觉了,但是新问题来了,他这样会超过这个行的高度,好吧,没有更多选项,也是一个问题,我的需求是,高度饱满

又继续查文档

查到这玩意,好了,问题解决

我配置代码帖下面,你们复制写起来快点,顺便骂骂产品,什么需求嘛

	calendarOptions: {
				plugins: [
					dayGridPlugin,
					timeGridPlugin,
					interactionPlugin, // needed for dateClick
				],
				height: 400,
				// aspectRatio: 2,
				// contentHeight: 500,
				// handleWindowResize: true, //是否随浏览器窗口大小变化而自动变化。
				// allDaySlot: true,
				// 头部按钮位置 ToToday
				headerToolbar: {
					left: "",
					center: "prev,title,next",
					right: "",
				},

				customButtons: {
					prev: {
						// text: "<",
						click: function (data) {
							that.$refs.FullCalendar.getApi().prev();
							that.$emit("prev", that.$refs.FullCalendar.getApi().getDate());
							that.timeGetInit();
						},
					},
					next: {
						click: function (data) {
							console.log(data);
							that.$refs.FullCalendar.getApi().next();
							that.$emit("next", that.$refs.FullCalendar.getApi().getDate());
							that.timeGetInit();
						},
					},
					ToToday: {
						text: "回到今天",
						click: function (data) {
							that.$refs.FullCalendar.getApi().today();
							that.timeGetInit();
						},
					},
					dayGridMonth: {
						text: "月",
						click: function (data) {
							that.$refs.FullCalendar.getApi().changeView("dayGridMonth");
							that.type = 0;
							that.timeGetInit();
						},
					},
					timeGridWeek: {
						text: "周",
						click: function (data) {
							that.$refs.FullCalendar.getApi().changeView("timeGridWeek");
							that.type = 1;
							that.timeGetInit();
						},
					},
					timeGridDay: {
						text: "日",
						click: function (data) {
							that.$refs.FullCalendar.getApi().changeView("timeGridDay");
							that.type = 2;
							that.timeGetInit();
						},
					},
				},
				nowIndicator: true,
				initialView: "timeGridWeek", // 默认为那个视图(月:dayGridMonth,周:timeGridWeek,日:timeGridDay)
				// firstDay: "1",
				slotDuration: "24:00",

				allDayText: "全天",

				events: null,
				initialEvents: null, // alternatively, use the `events` setting to fetch from a feed
				editable: true, // 是否可以进行(拖动、缩放)修改
				eventStartEditable: true, // 是否可以修改日程开始时间
				droppable: true,

				eventDrop: this.eventDrop,
				selectable: true, // 是否可以选中日历格
				selectMirror: true,
				// dayMaxEvents: true,
				weekends: true,
				eventReceive: this.handleEventReceive,
				eventMaxStack: 10,
				dayMaxEventRows: true, // for all non-TimeGrid views
				views: {
					timeGrid: {
						dayMaxEventRows: 10, // adjust to 6 only for timeGridWeek/timeGridDay
					},
				},
				// expandRows: true,
				// eventTextColor: "#fff",
				// textColor: "#000",
				// eventLimit: 10,
				// eventLimitText: "更多", //当一块区域内容太多以"+2 more"格式显示时,这个more的名称自定义(应该与eventLimit: true一并用)
				aspectRatio: 2, //设置日历单元格宽度与高度的比例
				select: this.handleDateSelect, //选中日历单元格事件
				eventClick: this.handleEventClick, // 点击日历日程事件
				eventMouseEnter: this.eventMouseEnter, // 鼠标滑过
				eventsSet: this.handleEvents,
				// selectOverlap: false,
				// unselectAuto: true,
				locale: "zh-cn", // 切换语言,当前为中文
				buttonText: {
					// 设置按钮
					today: "今天",
					month: "月",
					week: "周",
					day: "天",
				},
				slotEventOverlap: false,
			},
  • 9
    点赞
  • 3
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值