vue跨域解决方法

vue跨域解决方法,第1张

async downloadFile() {

const cname = thisloginUserusername

const params = await thisgetParams()//自己写的获取参数方法

axios({

url: ${baseURL}/download ,

method: 'post',

data: params,

responseType: 'blob',

headers: {

cid: thiscustomerCode

}

})then(res => {

const fileName = wifi预警_${cname}csv

var blob = resdata

if ('msSaveOrOpenBlob' in navigator) {

windownavigatormsSaveOrOpenBlob(blob, fileName) //IE导出

} else {

let url = windowURLcreateObjectURL(new Blob([blob]))

let link = documentcreateElement('a')

linkstyledisplay = 'none'

linkhref = url

linksetAttribute('download', fileName)

linkclick()

}

})

},

以上就是关于vue跨域解决方法全部的内容,包括:vue跨域解决方法、vue中给的默认值是调接口取到的、32.Webpack-Proxy等相关内容解答,如果想了解更多相关内容,可以关注我们,你们的支持是我们更新的动力!

欢迎分享,转载请注明来源:内存溢出

原文地址: https://www.outofmemory.cn/web/9797907.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2023-05-02
下一篇 2023-05-02

发表评论

登录后才能评论

评论列表(0条)

保存