백엔드 단은 장고 restapi로 구현하였고 프론트단은 vue.js를 사용하였다
vue에서 파일 다운로드를 구현하기 위해선 아래와 같은 작업이 추가적으로 필요하다
let blob = new Blob([response.data], {type: response.headers['content-type']});
let link = document.createElement('a');
link.href = window.URL.createObjectURL(blob);
link.download = fileName;
link.click()
// this.$store.commit('SET_FILE_COUNT', response.data.data);
// this.$store.commit('SET_FILE_LIST', response.data.data);
// this.showFile = !this.showFile;
다음번에 좀더 디테일하게 적겠다.
'development > Mr.dJango 장고뽀개기' 카테고리의 다른 글
Django values_list() (0) | 2020.04.24 |
---|---|
wkhtmltopdf 파일 변환시 폰트 깨지는 현상 (0) | 2019.10.31 |
install pycropto error (0) | 2019.08.21 |
json.decoder.JSONDecodeError: Expecting value: line 1 column 1 (char 0) 에러가 발생했을경우 (0) | 2019.07.10 |
django.core.exceptions.ImproperlyConfigured: The SECRET_KEY setting must not be empty. 에러 (0) | 2019.05.08 |