js或者vue直接导出(下载)有路径的文件或图片
1. 用于vue下diseaseInfo(){API.diseaseExportExcel().then(result=>{let iframe = document.createElement('iframe')//console.log(iframe)iframe.style.display = 'none'...
·
1. 用于vue下
diseaseInfo(){
API.diseaseExportExcel().then(result=>{
let iframe = document.createElement('iframe')
//console.log(iframe)
iframe.style.display = 'none'
iframe.src = '/yxcAdmin/disease/export/excel'
iframe.onload = function () {
document.body.removeChild(iframe)
}
document.body.appendChild(iframe)
},function (err) {
this.$message.error({
showClose: true,
message: err.message.toString(),
duration: 2000
});
}).catch()
}
2. 用于原生JS下
function diseaseInfo(){
let iframe = document.createElement('iframe')
iframe.style.display = 'none'
iframe.src = '/yxcAdmin/disease/export/excel'
iframe.onload = function () {
document.body.removeChild(iframe)
}
document.body.appendChild(iframe)
},
更多推荐
已为社区贡献18条内容
所有评论(0)