post配置:
axios.post("http://xxx.com/xxx/xxx/xxx?",
{
limit: 10,
page: 1,
},
{
headers: {authorization: `Bearer ${localStorage.getItem("token2")}`}
}
).then((res)=>{
console.log(res)
})
get配置
axios.get("http://xxx.com/xxx/xxx/xxx?", {
params: {
limit: 10,
page: 1,
teacher_id: id
},
headers: {
authorization: `Bearer ${localStorage.getItem("token2")}`
}
}).then((res) => {
console.log(res)
})
put配置
axios.put("http://xxx.com/xxx/xxx/xxx?",
params:{
limit: 10,
page: 1,
collect_id: id
}, //要传的参数
{
headers: {
authorization: `Bearer ${token}`
}
}
)
.then(res => {
console.log( res);
})