1
我使用JSPdf上的角应用程序,我试图用JS autotable插件,但我遇到的JS错误jsPDF AutoTable - autoTable不是一个函数
EXCEPTION: Uncaught (in promise): TypeError: doc.autoTable is not a function
TypeError: doc.autoTable is not a function
我有通过npm安装jspdf和jspdf-autotable,我确认它们在节点模块中。
我已经导入这两个插件是这样的:
import * as jsPDF from 'jspdf'
import * as autoTable from 'jspdf-autotable'
这里是我的代码:
private renderPdf():void{
let testcolumns = ["TestCol1", "TestCol2"];
let testrows = [["test item 1", "test item 2"]];
let doc = new jsPDF();
doc.autoTable(testcolumns, testrows);
doc.save('sample.pdf');
}
有什么我可以在这里失去了以上的代码,我可以提供帮助确定问题?
谢谢!
天哪 - 我不能感谢你才好! –