responseType: "blob"导致不能获取查看后台返回的信息
const fileReader = new FileReader()
fileReader.readAsText(new Blob([response.data], { type: 'application/octet-stream' }), 'utf-8')
fileReader.onload = () => {
const result = JSON.parse(fileReader.result)
// result可查看后台返回的提示信息
}
if (response.data.type === 'application/json') {
const fileReader = new FileReader()
fileReader.readAsText(new Blob([response.data], { type: 'application/octet-stream' }), 'utf-8')
fileReader.onload = () => {
const result = JSON.parse(fileReader.result)
this.$confirm(result.msg, '提示', {
confirmButtonText: '确定', // '确定',
cancelButtonText: '取消', // '取消',
type: 'warning'
}).then(() => {
}).catch(() => {
})
}
} else {
this.makeDownload(response, value.fileName);
}