Vue 中Axios 使用

1、安装axios

npm install axios

2、在使用的地方导入

import axios from 'axios'

3、再方法中调用

 sendHttp: function () {
      axios.get('http://xxx/fileUpload')
        .then(response => (this.info = response))
        .catch(function (error) { // 请求失败处理
          console.log(error)
        })
    }

  





原文地址:https://www.cnblogs.com/linlf03/p/10955082.html