2

在将 WebDataRocks 集成为数据透视表的角度时,出现错误

'EventEmitter<CellData>' 类型上不存在属性 'next'

这是我的代码,

import { Component, ElementRef, Input, Output, EventEmitter, OnInit } from '@angular/core';
import * as WebDataRocks from 'webdatarocks';
@Component({
    selector: 'app-wbr-pivot',
    template: `<div><div class='wbr-ng-wrapper'></div></div>`
})
export class WebdatarocksComponent implements OnInit{
    // params
    @Input() toolbar: boolean;
    @Input() width: string | number;
    @Input() height: string | number;
    @Input() report: WebDataRocks.Report | string;
    @Input() global: WebDataRocks.Report;
    @Input() customizeCell: (cell: WebDataRocks.CellBuilder, data: WebDataRocks.CellData) => void;
    // events
    @Output() cellclick: EventEmitter<WebDataRocks.CellData> = new EventEmitter();
    
    // api
    public webDataRocks: WebDataRocks.Pivot;
    // private
    private root: HTMLElement;

    constructor(private el: ElementRef) {  }

    ngOnInit() {
      this.root = this.el.nativeElement as HTMLElement;
      this.webDataRocks = new WebDataRocks({
          container: this.root.getElementsByClassName('wbr-ng-wrapper')[0],
          width: this.width,
          height: this.height,
          toolbar: this.toolbar,
          report: this.report,
          global: this.global,
          customizeCell: this.customizeCell,
          cellclick: (cell: WebDataRocks.CellData) => this.cellclick.next(cell)
      });
    }
}
4

2 回答 2

0

EventEmitter 的next方法被弃用,取而代之的是emit

this.cellclick.emit(cell)
于 2021-08-17T12:28:27.063 回答
0

无法用我这边的相同代码重现这一点。您是否更改了示例项目中的其他任何内容?

于 2021-07-06T10:16:07.900 回答