1. 在main.js导入axios
2. 通过axios对象定义拦截器
import {createApp} from 'vue' import App from './App.vue' import Antd from 'ant-design-vue'; import 'ant-design-vue/dist/antd.css'; import axios from "axios"; import router from './router' import store from './store'/*** axios拦截器 ---request拦截器*/ axios.interceptors.request.use(config => {console.log('请求参数', config)return config },error => {console.log('请求错误', error)return Promise.reject(error) })/*** axios拦截器 ---response拦截器*/ axios.interceptors.response.use(response => {console.log('响应参数', response)return response },error => {console.log('响应错误', error)return Promise.reject(error) })createApp(App).use(Antd).use(store).use(router).mount('#app')