this.$http({
method:‘post’,
url:’’,
data:{},
responseType:’arraybuffer’
})
.then((res) => {
const fileName =‘order’;
const blob = newBlob([data],{ type: 'application/vnd.ms-excel' });
const link =document.createElement('a');
link.href =window.URL.createObjectURL(blob);
link.download = fileName+’.xls’;
link.click();
})
blob的文件格式type为接口请求成功之后的response headers里的content-type
网友评论