vue中axios的基本使用

挂载到vue构造函数的prototype上使用



import axios from 'axios'
import Vue from 'vue'
Vue.prototype.$http = axios
//后续new一个vue实例后,在.vue文件中可以通过this.$http 发起网路请求

创建axios实例使用


``` import axios from 'axios' import Vue from 'vue' Vue.prototype.$http = axios //后续new一个vue实例后,可以通过this.$http 发起网路请求
posted @ 2021-09-13 12:25  Fen~  阅读(38)  评论(0)    收藏  举报