1、新建pdf.js
class pdf {
static download(data, name,isRandom = true) {
const link = document.createElement('a')
let blob = new Blob([data],{type: 'application/pdf;charset=utf-8'});
link.style.display = 'none'
link.href = URL.createObjectURL(blob);
if (isRandom) {
let num = ''
for(let i=0;i < 10;i++){
num += Math.ceil(Math.random() * 10)
}
link.setAttribute('download', name)
}else {
link.setAttribute('download', name)
}
document.body.appendChild(link)
link.click()
document.body.removeChild(link)
}
}
export {
pdf
}
2、新建manage.js封装axios
export function exportction(url, parameter) {
return axios({
url: url,
method: 'get',
params: parameter,
responseType: 'blob&#