2

我正在使用带有tippy js的角度的fullcalendar(v3)事件渲染,那么如何在fullcalendar(v3)事件渲染中将角度动态组件附加到tippy js内容。

    const eventRender = function (event: IEvent, view) {
        if (event.info) {
            const factory = this._resolver.resolveComponentFactory(EventViewComponent);
            let ref;
            if (event.rendering === 'background') {
                ref = factory.create(this._injector, [], view.get(0));
            } else {
                ref = factory.create(this._injector, [], view.children('.fc-content').get(0));
            }
            ref.instance.eventInfo = event.info;
            this.dynamicComponent.push(ref);
            this._app.attachView(ref.hostView);
        }

而且我只是创建动态组件并将事件渲染附加到全日历

4

1 回答 1

1

html:

<div #tippyTemplate>
    <h4>Caption</h4>
    <p>Some content</p>
</div>

ts:

@ViewChild("tippyTemplate", { read: ElementRef, static: false }) tippyTemplate: ElementRef;
...
const template = this.tippyTemplate.nativeElement;

tippy(info.el, {
   content: template,
   allowHTML: true,
   hideOnClick: "toggle",
   placement: "top",
   trigger: "click",
});
于 2020-08-21T09:38:36.180 回答