vue Execel // template download

<a href="#" @click="templateDownload()"> template download </a>
 
// template download
templateDownload() {
this. $ axios ({
url: '/chenfan_refuse/otherRecord/otherRecordExcelDownload',
method: 'get',
responseType: 'blob'
}).then((data) => {
const blob = new Blob([data], { type: 'text/plain;charset=utf-8' })
const url = window.URL.createObjectURL(blob)
const a = document.createElement('a')
a.href = url
a.download = 'Receipt other new .xlsx'
document.body.appendChild(a)
a.click()
window.URL.revokeObjectURL(url)
document.body.removeChild(a)
. This $ Loading.finish (); // end of the progress bar
})
},

Guess you like

Origin www.cnblogs.com/wssdx/p/11468660.html