1.原因:google浏览器内部判断了是不是PDF ,如果是就会启动内置的PDF阅读器。
解决:file-saver
import FileSave from ‘file-saver‘; downloadPDF(URLToPDF,PDFName) { var oReq = new XMLHttpRequest(); oReq.open("GET", URLToPDF, true); oReq.responseType = "blob"; oReq.onload = function() { var file = new Blob([oReq.response], { type: ‘application/pdf‘ }); FileSave.saveAs(file, PDFName); }; oReq.send(); },