Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/reactjs/23.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
ReactJs:autoTable不是一个函数_Reactjs - Fatal编程技术网

ReactJs:autoTable不是一个函数

ReactJs:autoTable不是一个函数,reactjs,Reactjs,我在ReactJs应用程序上使用JSPdf,我试图使用JS自动表插件,但遇到了JS错误 异常:未捕获(承诺中):类型错误:doc.autoTable不是一个函数 类型错误:doc.autoTable不是一个函数 我已经通过npm安装了jspdf和jspdf自动表,我确认它们在节点模块中 我以这种方式导入了两个插件: import {jsPDF} from 'jspdf'; import 'jspdf-autotable'; const generatePDF = () =>

我在ReactJs应用程序上使用JSPdf,我试图使用JS自动表插件,但遇到了JS错误

异常:未捕获(承诺中):类型错误:doc.autoTable不是一个函数

类型错误:doc.autoTable不是一个函数

我已经通过npm安装了jspdf和jspdf自动表,我确认它们在节点模块中

我以这种方式导入了两个插件:

import  {jsPDF} from 'jspdf';   
 import 'jspdf-autotable';    
const generatePDF = () => {    
  const doc = new jsPDF("p", "mm", "a4"); 
     doc.autoTable({    
    body: [   
      [{ content: 'Text', colSpan: 2, rowSpan: 2, styles: { halign: 'center' } }],    
    ],     
  })
  doc.text("Hello world!", 10, 10);    
  doc.save('table.pdf')    ` 
}