相关疑难解决方法(0)

jsPDF 类型上不存在属性“autoTable”

我正在使用angular2Node JS。我已经使用.jspdfjspdf-autotable安装了这两个模块npm。在 angular-cli.json 文件中,我嵌入了脚本:

"scripts": [ 
        "../node_modules/jspdf/dist/jspdf.min.js",
        "../node_modules/jspdf-autotable/dist/jspdf.plugin.autotable.js"
      ],
Run Code Online (Sandbox Code Playgroud)

在我的component.ts文件中,我按如下方式导入了这些文件:

 import * as jsPDF from 'jspdf'; 
 import * as autoTable from 'jspdf-autotable';
Run Code Online (Sandbox Code Playgroud)

我也试过这些行来导入 jspdf-autotable

import { autoTable } from 'jspdf-autotable'; 
import 'jspdf-autotable';
Run Code Online (Sandbox Code Playgroud)

但没有任何效果。

component.ts文件功能中,我使用的示例代码如下:

var columns = ["ID", "Country", "Rank", "Capital"];
        var data = [
            [1, "Denmark", 7.526, "Copenhagen"],
            [2, "Switzerland",  7.509, "Bern"],
            [3, "Iceland", 7.501, "Reykjavík"],
            [4, "Norway", 7.498, "Oslo"],
            [5, "Finland", 7.413, "Helsinki"]
        ]; …
Run Code Online (Sandbox Code Playgroud)

javascript jspdf typescript jspdf-autotable angular

1
推荐指数
4
解决办法
2万
查看次数

标签 统计

angular ×1

javascript ×1

jspdf ×1

jspdf-autotable ×1

typescript ×1