js创建A标签实现下载

//导出Excel
  public async btnExport() {
   let that = this as any;
    this.loading = true;
    let a = document.createElement(‘a‘);//创建a标签
    a.href =  "";//文件url
    document.body.appendChild(a);
    a.click();//触发下载
    document.body.removeChild(a);
    setTimeout(async () => {
      that.loading = false;
    }, 4000);//4s后关闭loading,可以根据条数增减
  }

js创建A标签实现下载

上一篇:vue中引入jquery


下一篇:【P2P网络中的声誉计算】The EigenTrust Algorithm for Reputation Management in P2P Networks