mycomponent.ts
import jsPDF from 'jspdf';
import autoTable from 'jspdf-autotable';
export class Component implements OnInit {
.
.
.
exportPdf() {
const doc = new jsPDF('p', 'pt');
columns = [...]
autoTable(doc, {
columns: this.columns,
body: this.data,
didDrawPage: (dataArg) => {
doc.text('data', dataArg.settings.margin.left, 10);
}
});
doc.save('data.pdf');
}
}package.json
"dependencies": {
"jspdf": "^2.5.1",
"jspdf-autotable": "^3.5.23"
}我用npm和npm autotable安装了我的npm包,但是同样的错误仍然存在。我不明白我该怎么做。版本错了吗?
发布于 2022-04-18 12:28:44
您必须将@types/jspdf和@types/jspdf-autotable安装为开发依赖项。
如果你使用yarn
yarn add -D @types/jspdf @types/jspdf-autotable对于npm的使用:
npm install @types/jspdf @types/jspdf-autotable --save-devhttps://stackoverflow.com/questions/71911641
复制相似问题