Угловой, как импортировать Tooltip.js и инициализировать его в файле TS - PullRequest
0 голосов
/ 02 апреля 2019

Я не знаю, как импортировать tooptip.js в app.component.ts.Кто-нибудь может научить меня?

import { Component, OnInit, ViewChild } from '@angular/core';
import { OptionsInput } from '@fullcalendar/core';
import timeslot from '@fullcalendar/resource-timeline';
import interactionPlugin from '@fullcalendar/interaction';
import { CalendarComponent } from 'ng-fullcalendar';
// import Tooltip from 'node_modules/tooltip/src/index';

@Component({
  selector: 'app-root',
  templateUrl: './app.component.html',
  styleUrls: ['./app.component.css']
})
export class AppComponent implements OnInit{
  options: OptionsInput;
  eventsModel: any;
  @ViewChild('fullcalendar') fullcalendar: CalendarComponent;

  ngOnInit(): void {
    // @ts-ignore
    this.options = {
      editable: false,
      resourceLabelText: 'Rooms',
      // eventClick: (info) => {
      //   const tooltip = new Tooltip(info.el, {
      //     title: info.event.extendedProps.description,
      //     placement: 'top',
      //     trigger: 'hover',
      //     container: 'body'
      //   });
      // },
      resources: [{
        id: 'a',
        title: 'Room A'
      },
        {
          id: 'b',
          title: 'Room B'
        }],
      events: [{
        id: 'a',
        resourceId: 'a',
        start: '2019-04-01T01:00:00', end: '2019-04-01T02:00:00',
        description: 'haha',
        title: 'a'
      }, {
        id: 'b',
        resourceId: 'b',
        start: '2019-04-01T02:00:00', end: '2019-04-01T03:00:00',
        title: 'b',
        description: 'haha'
      }],
      aspectRatio: 1.8,
      timeZone: 'UTC',
      defaultView: 'resourceTimelineDay',
      schedulerLicenseKey: 'GPL-My-Project-Is-Open-Source',
      scrollTime: '08:00',
      views: {
        resourceTimelineDay: {
          buttonText: 'Lession',
          slotDuration: '00:15'
        }
      },
      header: {
        left: 'prev,next today',
        center: 'title',
        right: 'resourceTimelineDay'
      },
      plugins: [ timeslot, interactionPlugin ]
    };
  }
}

Когда я импортирую всплывающую подсказку и инициализирую ее в eventRender{}, на странице просмотра ничего не происходит.

<div class="pl-3 pr-3 pt-3 pb-3">
    <ng-fullcalendar #fullcalendar [options]="options"></ng-fullcalendar>
</div>

Когда я нажимаю на нее, появляется ошибкапоказывает:

The errors img shown here

Так как мне поступить?

Добро пожаловать на сайт PullRequest, где вы можете задавать вопросы и получать ответы от других членов сообщества.
...