vue+element導出

exportEXCEL(){ 
      axios({
      method: 'get',
      url: `${axios.defaults.baseURL2}/export`,
      params: {
            bdzId: this.form.transformer,
            nAME: this.form.nAME,
            productFactory: this.form.product  
       },
      responseType: 'blob'
    })
     .then(res=>{
          console.log(res,66666);
          let url = window.URL.createObjectURL(res.data)//URL.createObjectURL(blob)獲取當前文件的一個內存URL
            let link = document.createElement('a')
            link.style.display = 'none'
            link.href = url
            link.setAttribute('download','臺帳.xls')
            document.body.appendChild(link)
            link.click()
       })

    }
相關文章
相關標籤/搜索