import axios from 'axios'
exportExcel () { let url = 'http...', axios.get(url, { headers:{ "Admin_token":token }, responseType: 'blob', //二进制流 }).then(function (res) { if(!res) return let blob = new Blob([res.data], {type: 'application/vnd.ms-excel;charset=utf-8'}) let url = window.URL.createObjectURL(blob); let aLink = document.createElement("a"); aLink.style.display = "none"; aLink.href = url; aLink.setAttribute("download", "excel.xls"); document.body.appendChild(aLink); aLink.click(); document.body.removeChild(aLink); window.URL.revokeObjectURL(url); }).catch(function (error) { console.log(error) }); }