一、a 标签

移动端不支持

onDownFile= (url, filename) => {
    const downUrl = `http://10.1.109.123:19092/down/to?url=${encodeURIComponent(url)}`;
    // 创建隐藏的可下载链接
    const eleLink = document.createElement('a');
    eleLink.download = filename;
    eleLink.style.display = 'none';
    // 字符内容转变成blob地址
    const blob = new window.Blob([downUrl]);
    eleLink.href = URL.createObjectURL(blob);
    // 触发点击
    document.body.appendChild(eleLink);
    eleLink.click();
    // 然后移除
    document.body.removeChild(eleLink);
  }

 

相关文章:

  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-09-15
  • 2022-01-11
  • 2021-04-04
  • 2022-12-23
  • 2022-12-23
猜你喜欢
  • 2021-12-18
  • 2022-12-23
  • 2021-12-28
  • 2021-11-01
  • 2021-05-28
  • 2022-12-23
  • 2022-12-23
相关资源
相似解决方案