vue 封装的axios接口,请求接口动态增加headers&responseType

一、遇到一个需求,掉接口的时候,给headers中添加一个参数

// 调试日志下载
export const getDebug  = (params) => {
	const uploadaxios = axios.create({
		headers:{
			'Range':'bytes=0-'
		},
		responseType: 'blob'
	})
	return uploadaxios.get(`/device_maintenance/file_get`, {params} ).then(res => res.data);
	
};
// 可以加一个参数吧headers传进来

在这里插入图片描述

猜你喜欢

转载自blog.csdn.net/weixin_53587375/article/details/129727863