axios 发送ajax请求
1、安装
npm install axios --save
2、导入axios
import axios from 'axios'
3、在main.js中配置
Vue.prototype.$axios = axios
this.$axios
4、发送请求
this.$axios.get('url') .then(function (response){ console.log(response); // 请求成功后,获取的相应内容 }) .catch(function (response){ console.log(response); // 请求失败后,获取的相应内容 })
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 [email protected] 举报,一经查实,本站将立刻删除。