| | |
| | | this.$confirm('立即下载或者后台下载?', '提示', { |
| | | confirmButtonText: '立即下载', |
| | | cancelButtonText: '后台下载', |
| | | distinguishCancelAndClose: true, |
| | | type: 'warning' |
| | | }) |
| | | .then(() => { |
| | | this.loading = true |
| | | this.exportData() |
| | | }) |
| | | .catch(() => { |
| | | this.loading = false |
| | | this.exportData() |
| | | .catch(action => { |
| | | if (action === 'cancel') { |
| | | this.loading = false |
| | | this.exportData() |
| | | } else { |
| | | this.loading = false |
| | | } |
| | | }) |
| | | }, |
| | | exportData() { |
| | |
| | | cancel = c |
| | | }), |
| | | onDownloadProgress(progress) { |
| | | console.log('onDownloadProgress', progress) |
| | | const loaded = progress.loaded |
| | | // progress对象中的loaded表示已经下载的数量,total表示总数量,这里计算出百分比 |
| | | let downProgress = Math.round((loaded / totalSize) * 100) |
| | |
| | | link.click() |
| | | // 下载完成进行释放 |
| | | url.revokeObjectURL(link.href) |
| | | this.$message.success('下载完成!') |
| | | this.$message({ |
| | | showClose: true, |
| | | duration: 0, |
| | | message: '下载完成!', |
| | | type: 'success' |
| | | }) |
| | | this.loading = false |
| | | } |
| | | }, |