我正在一个Angular应用程序中使用JSPdf,并尝试使用JS autotable插件,但我遇到了JS错误。
异常信息如下:
EXCEPTION: Uncaught (in promise): TypeError: doc.autoTable is not a function TypeError: doc.autoTable is not a function
我已经通过npm安装了jspdf和jspdf-autotable,并确认它们在node模块中。
我是这样导入两个插件的:
异常信息如下:
EXCEPTION: Uncaught (in promise): TypeError: doc.autoTable is not a function TypeError: doc.autoTable is not a function
我已经通过npm安装了jspdf和jspdf-autotable,并确认它们在node模块中。
我是这样导入两个插件的:
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');
}
这里是否有什么我可能遗漏的或者更多的代码可以提供来帮助确定问题呢?
谢谢!