我在 Fullcalendar 的 eventMouseEnter 和 eventMouseLeave 事件上添加了 Tooltip.js,但 Tooltip 没有样式,它只显示纯文本。见下图。
我试图在这里使用这个例子,但没有结果。
如何像以下示例一样设置工具提示的样式?
这是我的代码:
约会.component.ts
import { Component, ViewChild } from '@angular/core';
import { FullCalendarComponent } from '@fullcalendar/angular';
import { EventInput } from '@fullcalendar/core';
import dayGridPlugin from '@fullcalendar/daygrid';
import timeGrigPlugin from '@fullcalendar/timegrid';
import interactionPlugin from '@fullcalendar/interaction';
import roLocale from '@fullcalendar/core/locales/ro';
import Tooltip from 'tooltip.js'
@Component({
selector: 'app-appointment',
templateUrl: './appointment.component.html',
styleUrls: ['./appointment.component.css']
})
export class AppointmentComponent {
tooltip: Tooltip;
@ViewChild('calendar') calendarComponent: FullCalendarComponent; // the #calendar in the template
calendarLocale = roLocale;
calendarVisible = true;
calendarPlugins = [dayGridPlugin, timeGrigPlugin, interactionPlugin];
calendarWeekends = true;
calendarEvents: EventInput[] = [
{ title: 'Cod: #123124124', description: "TEXT", start: new Date(), customRender: true },
];
handleEventMouseEnter(info) {
this.tooltip = new Tooltip(info.el, {
title: info.event.title,
placement: 'top'
});
}
handleEventMouseLeave(info) {
this.tooltip.dispose();
}
}
约会.component.html
<app-navbar></app-navbar>
<full-calendar #calendar defaultView="dayGridMonth"
[header]="{left: 'prev,next today', center: 'title', right: 'dayGridMonth,timeGridWeek,timeGridDay,listWeek'}"
[plugins]="calendarPlugins" [weekends]="calendarWeekends" [events]="calendarEvents" [locale]="calendarLocale"
(eventMouseEnter)="handleEventMouseEnter($event)"
(eventMouseLeave)="handleEventMouseLeave($event)"></full-calendar>
LE:似乎 CSS 不适用。我使用了示例中的 CSS。