在main.js中直接配置 //导入axios import axios from 'axios' //配置请求的根路径 axios.defaults.baseURL=‘根路径’ Vue.prototype.$http = axios