vim demon03.vue <template> <div class="home"> </div> </template> <script> import axios from 'axios' export default { name: 'demon03', components: {}, created() { //创建axios实例 //axios实例:当后端地址有多个,并且超时时长不一样 let instance01 = axios.create({ baseURL: 'http://127.0.0.1:8080', timeout: 1000 }) let instance02 = axios.create({ baseURL: 'http://127.0.0.1:8090', timeout: 1500 }) //使用axios实例 instance01.get('/data.json').then(res=>{ console.log(res) }) instance02.get('city.json').then(res=>{ console.log(res) }) } } </script>