Notice
일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | ||||||
2 | 3 | 4 | 5 | 6 | 7 | 8 |
9 | 10 | 11 | 12 | 13 | 14 | 15 |
16 | 17 | 18 | 19 | 20 | 21 | 22 |
23 | 24 | 25 | 26 | 27 | 28 | 29 |
30 | 31 |
Tags
- OOP
- NPM
- 기후변화
- 클로저
- 객체참조 #객체
- url #querystring
- ESLint
- jest
- git pair
- #cloudfront #s3 #html 확장자 없애기
- this
- TypeScript
- lightsail nodejs apache
Archives
- Today
- Total
Hello World...
axios POST 방식으로 파일 다운 받기 본문
location.href 방식으로 다운로드를 받았는데,
axios post 방식으로도 받을 수 있다.
이 때는 response type을 blob 형식으로 받아야 한다.
https://www.npmjs.com/package/js-file-download
모듈을 사용하면 편하다.
https://stackoverflow.com/questions/41938718/how-to-download-files-using-axios
ex)
vue.js
downloadList(payload) {
// location.href = `/admin/getUserListExcel.do?${payload}`;
return $axios.post('/admin/getUserListExcelPost.do', payload, { responseType: 'blob' });
},
import fileDownLoad from 'js-file-download';
const file = await this.downloadList(payload);
fileDownLoad(file.data, 'UserList.xlsx');
'vue.js' 카테고리의 다른 글
vue-echarts 에서 markArea 사용하기 (0) | 2022.12.20 |
---|---|
vite.config.js asset 폴더 이름 변경하기 (0) | 2022.11.15 |
vue3, vue-router4 에서 base path 설정하기 (0) | 2022.10.26 |
nuxt2 base path 설정하기 (0) | 2022.10.25 |
Vue.js3 - fontawesome prefix 에러 나는 경우 (0) | 2022.02.26 |
Comments