获取验证码
const res = await indexApi.getCaptcha();
let url = (URL || webkitURL).createObjectURL(res);
setImgUrl(url)
注意要在get请求的请求头里面加属性
export async function getCaptcha(options) {
return request('/energyops/captcha.jpg', {
method: 'GET',
// responseType: 'arraybuffer',
responseType: 'blob', //这里特殊注明返回格式是文件流
...(options || {}),
});
}