Advertisement

将网络层应用逻辑内核化至HTTP层,并实现基于AXIO的高效API调用

阅读量:
复制代码

axios版本信息

复制代码
>       1. import axios from 'axios'

>  
>       2. import {message} from './message'
>  
>       3. import main from '../../application'
>  
>       4. import context from '@/main'
>  
>       5. // create an axios instance
>  
>       6. const service = axios.create({
>  
>       7.   baseURL: main.url, // 我在这里专门弄了一个js文件存储地址。不知道他们根据打包方式选择配置文件如何做到的,我就用了一个笨办法
>  
>       8.   withCredentials: false, // send cookies when cross-domain requests
>  
>       9.   timeout: 1000000, // request timeout
>  
>       10. })
>  
>       11.  
>  
>       12. // 请求之前的拦截器
>  
>  

全部评论 (0)

还没有任何评论哟~