|
exportExcel(){ const token = Vue.ls.get(ACCESS_TOKEN) axios({ headers: { Authorization: 'Bearer ' + token, 'Access-Token': token }, method: 'GET', url: '/exportExcel', responseType: 'arraybuffer', }) .then(response => { let data = response.data var newBlob = new Blob([data], { type: 'text/plain;charset=UTF-8' }) var anchor = document.createElement('a') anchor.download = '导出Excel名称' + new Date().getTime() + '.xlsx' anchor.href = window.URL.createObjectURL(newBlob) anchor.click() }) .catch(async e => { this.$Message.error(e.toString()) }) } |