diff --git a/JsonExcel.vue b/JsonExcel.vue index d033435..b62b70e 100644 --- a/JsonExcel.vue +++ b/JsonExcel.vue @@ -128,7 +128,7 @@ export default { export:async function(data, filename, mime) { let blob = this.base64ToBlob(data, mime); if(typeof this.beforeFinish === 'function') - await this.beforeFinish(); + await this.beforeFinish(blob); download(blob, filename, mime); }, /* diff --git a/README.md b/README.md index bbf246f..9180517 100644 --- a/README.md +++ b/README.md @@ -46,7 +46,7 @@ In your template | worksheet | string | Name of the worksheet tab. default: 'Sheet1' | | fetch | Function | Callback to fetch data before download, if it's set it runs immediately after mouse pressed and before download process. IMPORTANT: only works if no data prop is defined | | before-generate | Function | Callback to call a method right before the generate / fetch data, eg:show loading progress | -| before-finish | Function | Callback to call a method right before the download box pops out, eg:hide loading progress | +| before-finish | Function | Callback to call a method right before the download box pops out, eg:hide loading progress. Gets resulting binary blob as argument for examination or reuse. | ## Example @@ -238,8 +238,9 @@ export default { startDownload(){ alert('show loading'); }, - finishDownload(){ + finishDownload(blob){ alert('hide loading'); + alert(`file size: ${blob.size}`); } } }; diff --git a/package.json b/package.json index a543c5b..cb1e9c5 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "vue-json-excel", - "version": "0.2.98", + "version": "0.2.99", "description": "Download your JSON as an excel or CSV file directly from the browser", "main": "JsonExcel.vue", "scripts": {