我正在使用新的dom-to-image库,当我尝试在toPng
组件内部调用该方法时遇到此错误。
import domtoimage from 'dom-to-image-more';
export class MyComponent {
@ViewChild('leafletMap') leafletMap: ElementRef;
downloadMap = (): void => {
//error happens here
domtoimage.toPng(this.leafletMap.nativeElement).then((img: any) => {
console.log(img);
});
};
}
/* of course this is simplified */
LeafletMap 存在于我的组件 HTML 中,当我记录它时,它包含一个 HtmlNativeElement