Created
March 14, 2018 16:59
-
-
Save torbentschechne/ed8435a860073525488adeeb2f4e08c8 to your computer and use it in GitHub Desktop.
VueJs - Create & download a CSV file
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//CSV contents must be in response.data.data | |
invoiceApi.createExport(this.dateFrom.picker, this.dateTo.picker).then(response => { | |
if (response.data.success == true) { | |
let blob = new Blob([response.data.data], {type: 'text/csv'}); | |
let link = document.createElement('a'); | |
link.href = window.URL.createObjectURL(blob); | |
link.download = 'FileName_'+this.dateFrom.picker+'_'+this.dateTo.picker+'.csv'; | |
link.click(); | |
this.createExportLoading = false; | |
} | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment