ViewChild
import { Component, ViewChild, AfterViewInit } from '@angular/core';//假设的。这里引入你用到的table组件类import { TableComponent } from 'PrimeNG'@Component({
selector: 'app-xxx',
templateUrl: './xxx.component.html',
styleUrls: ['./xxx.component.css']
})export class XXXComponent implements AfterViewInit { //表格组件实例
@ViewChild('dt') dt:TableComponent constructor() {}
ngAfterViewInit(){ //页面组件初始化后调用
this.dt.exportCSV()
}
}