// post请求
axios.post('path', {}, {
headers: {
authorization: `Bearer ${token}`,
},
});
// get请求
axios.get('path', {
headers: {
authorization: `Bearer ${token}`,
},
});
// 统一方式
axios.defaults.headers['authorization'] = `Bearer ${token}`;
axios请求添加token的方法
最新推荐文章于 2025-06-08 17:52:09 发布