Angularjs1.6对接后台导出Excel的接口,
代码:
$http({
url: 'http://localhost:8083/console/devices/poi',
method: "POST",
data: {
"email": "官方邮箱"
},
headers: {
'Content-type': 'application/json'
},
responseType: 'arraybuffer'
}).then(function(data, status, headers, config) {
var blob = new Blob([data], { type: "application/vnd.ms-excel" });
var objectUrl = URL.createObjectURL(blob);
var a = document.createElement('a');
document.body.appendChild(a);
a.setAttribute('style', 'display:none');
a.setAttribute('href', objectUrl);
var filename = "记录.xls";
a.setAttribute('download', filename);
a.click();
URL.re