// 点击下载文件     
    downloadFile(item) {
      this.contextFile.index = -1;
      item.path = item.path.replace(/^http:/,"https:");
      this.download(item.path, item.title);
    },
    download (src, fileName) {
      let x = new XMLHttpRequest();
      x.open("GET", src, true);
      x.responseType = 'blob';
      x.onload = function(e) {
        let url = window.URL.createObjectURL(x.response)
        let a = document.createElement('a');
        a.href = url
        a.download = fileName
        a.click()
      }
      x.send();
    },
Logo

前往低代码交流专区

更多推荐