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)
},
Logo

前往低代码交流专区

更多推荐