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>

 

相关文章:

  • 2021-08-06
  • 2021-06-30
  • 2022-12-23
  • 2021-12-15
  • 2019-12-07
  • 2022-12-23
  • 2022-12-23
  • 2021-04-21
猜你喜欢
  • 2022-12-23
  • 2021-06-23
  • 2022-12-23
  • 2021-09-21
  • 2022-12-23
  • 2022-12-23
  • 2022-01-26
相关资源
相似解决方案