You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

24 lines
518 B

This file contains ambiguous Unicode characters!

This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.

# HTTP请求
本项目使用了axios提供http请求服务文件在src/utils/request.js
## 自定义Header
为了提供鉴权、修改cookie等服务可以手动修改Header
```
axios.defaults.headers.common['Authorization'] = 'token'
```
或者
```
// 添加请求拦截器
axios.interceptors.request.use(function (config) {
// 在发送请求之前做些什么
config.headers.token = window.localStorage.getItem('token');
return config;
}, function (error) {
return Promise.reject(error);
});
```