代码封装请求注意
export function certificatePdf(data) { return request({ url: '/report/raceCertificatePdf', method: 'post', data:data, responseType: 'blob' }) }
请求
certificatePdf(this.ids).then(res => { console.log(res); var binaryData = []; binaryData.push(res); let blob = new Blob(binaryData, { type: 'application/pdf;chartset=UTF-8' }); console.log(blob); let href = window.URL.createObjectURL(blob); //创建下载的链接 window.open(href) return })