下载附件时防止连点
如果是button 直接加loading就能搞定
<el-button type="text" :loading="downLoading" @click="downloadFn(item)">下载</el-button>
如果是标签要加一个判断事件
<span v-loading="downLoading" class="downText" @click="downloadFn(item)">下载</span>
// 下载
async downloadFn(file) {
if (this.downLoading === false) {
this.downLoading = true
const res = await downloadFileByUniq(file.url)
this.downLoading = false
const blob = new Blob([res], { type: '' })
const downloadElement = document.createElement('a')
const href = window.URL.createObjectURL(blob)
downloadElement.href = href
downloadElement.download = this.$dayJs().format('YYYY-MM-DD HH:mm:ss') + file.name
document.body.appendChild(downloadElement)
downloadElement.click()
document.body.removeChild(downloadElement)
window.URL.revokeObjectURL(href)
}
},