post文件下载

阅读更多
 this.$http({
          method: 'post',
          url: '/file/download',
          responseType: 'blob',
          data: JSON.stringify(this.theDocument)
        }).then(response => {
          let headers = response.headers
          let _blob = new Blob([response.data], {
            type: headers['Content-Type']
          })
          let _link = document.createElement('a')
          _link.href = window.URL.createObjectURL(_blob)
          _link.download = this.theDocument.thename
          _link.click()
        })

你可能感兴趣的:(文件下载)