vue下载导出文件

downLoadFile(state, res) {
        let blob = new Blob([res.data])
        let fileName = res.headers["content-disposition"].split("''")[1];
        const link = document.createElement('a')
        link.style.display = 'none'
        link.href = URL.createObjectURL(blob)
        link.setAttribute('download', decodeURI(fileName))
        document.body.appendChild(link)
        link.click()
    },

猜你喜欢

转载自blog.csdn.net/chen3647/article/details/127585498