AI智能
改变未来

axios基本配置

import axios from \'axios\'// import { Notification, MessageBox } from \'element-ui\'// import store from \'@/store\'// import { getToken } from \'@/utils/auth\'axios.defaults.headers[\'Content-Type\'] = \'application/json;charset=utf-8\'// 创建axios实例const service = axios.create({// axios中请求配置有baseURL选项,表示请求URL公共部分baseURL:\'http://192.168.1.200:30088\',// 超时timeout: 3000})// 请求拦截器service.interceptors.request.use(config => {return config}, () => {// 请求错误})// 响应拦截器service.interceptors.response.use(res => {return res}, () => {// 请求错误})export default service
赞(0) 打赏
未经允许不得转载:爱站程序员基地 » axios基本配置