zoukankan      html  css  js  c++  java
  • 下载附件时防止连点

    如果是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)
          }
        },
  • 相关阅读:
    Linux rcp命令详解
    Linux patch命令详解
    Linux paste命令详解
    linux od命令详解
    linux mv命令详解
    Linux more命令详解
    Linux mktemp命令
    MySQL状态变量详解
    mysql性能分析show profile/show profiles
    MySQL执行计划
  • 原文地址:https://www.cnblogs.com/hellofangfang/p/15543343.html
Copyright © 2011-2022 走看看