代码:
let blob = new Blob([this.form.marketingUrl], {
//this.form.marketingUrl 后端返回的存储地址
type: 'application/pdf ' //指的是下载的文件的格式type
});
let a = document.createElement('a');
a.style.display = 'none';
a.download = '下载成功';
a.href = URL.createObjectURL(blob);
document.body.appendChild(a);
a.click();
document.body.removeChild(a);
pdf type:application/pdf
ppt type:application/vnd.ms-powerpoint;charset=utf-8
world trpe: application/vnd.openxmlformats-officedocument.wordprocessingml.document
excel type:application/vnd.openxmlformats-officedocument.spreadsheetml.sheet;charset=utf-8