本地下载 web file操作

function download(){
    const link = document.createElement('a')
    link.href = window.location.origin  + `/static/doc/${this.type}.docx` + '?auth=' + getToken()

    const fileName = '20230615.docx'
    link.download = fileName

    document.body.appendChild(link)
    link.click()
    document.body.removeChild(link)

}

 

 

 

posted @ 2023-06-15 15:49  hjswlqd  阅读(31)  评论(0编辑  收藏  举报