1.判断返回是否blob数据流
downLoadTemplate() {
downloadmodel(函数体).then(res => {
var _this = this
if (res.data.type.includes('application/json')) {
const reader = new FileReader()
reader.onload = function () {
const res = reader.result
const result = JSON.parse(res)
if (result.code == 0) {
_this.$message.success(result.message)
} else {
_this.$message.error(result.message)
}
}
reader.readAsText(res.data)
} else {
SaveFile(res.data,名称+后缀)
}
})
},
2.SaveFile
export const SaveF