封装时候需要将传入的params参数进行结构
fetch: (url, params = {}, _ContentType = ContentType.urlencoded) => {
return new Promise((resolve, reject) => {
axios.get(url, {
//配置对象params
params:{
//传递过来请求参数params
...params
}
}
})
},
在定义方法的时候传递对象
getIntervieweeInfo: (id) => {
let sid={'id':id}
return http.fetch(API.getIntervieweeInfo,sid, 'application/json')
}
如果不结构的话会出现以下情况