安装npm i axios vue-axios -s 引用import axios from 'axios'import vueAxios from 'vue-axios'Vue.use(vueAxios, axios) 配置axios.defaults.baseURL = 'https://api.example.com' //前缀名axios.defaults.headers.common['Authorization'] = AUTH_TOKEN //token值axios.defaults.headers.post['Content-Type'] = 'application/x-www-form-urlencoded' //格式 使用this.axios .get("api/getlunbo",{参数,没有可以不写}) .then(res => { if (res.data.status == 0) { this.lunboArr = res.data.message; } else { alert("加载失败"); } });}