Javascript 反应:从'打开PDF;水滴';被要求陈述。使用';jsPDF';。返回:无法加载PDF文档
在调用aJavascript 反应:从'打开PDF;水滴';被要求陈述。使用';jsPDF';。返回:无法加载PDF文档,javascript,reactjs,blob,Javascript,Reactjs,Blob,在调用aaxios.get()之后,我试图打开pdfonClick。从mysql数据库获取数据 打开pdf的按钮的代码为 class DownloadPdf extends Component { constructor(props) { super(props) this.pdfGenerator = this.pdfGenerator.bind(this) } pdfGenerator(blob){ console.lo
axios.get()
之后,我试图打开pdfonClick
。从mysql数据库获取数据
打开pdf的按钮的代码为
class DownloadPdf extends Component {
constructor(props) {
super(props)
this.pdfGenerator = this.pdfGenerator.bind(this)
}
pdfGenerator(blob){
console.log(blob)
var doc = new jsPDF('p', 'pt');
var blobPDF = new Blob([doc.output[blob.data]], { type: 'application/pdf'})
var BlobURL = URL.createObjectURL(blobPDF)
window.open(BlobURL)
}
render() {
return (
<td>
<button onClick={()=>{this.pdfGenerator(this.props.blob)}}>
Download PDF
</button>
</td>
)
}
在我的axios请求从数据库获取数据之后
.then(res => { this.setState({
properties: res.data.data,
isLoaded: true,
})
})