axios的请求头header设置
1.post方法header设置:
post方式:
let {userId,token} ={} userId = userId?userId:'';token = token?token:'' axios.post(url, data,{headers: {userId,token}})
get方式:
let {userId,token} = {}; userId = userId?userId:'';token = token?token:'' axios.get(this.getUrl(url), {params:data,headers: {userId,token}})