axios请求

引入

全局引入

import axios from ‘axios’
Vue.prototype.$http=axios;

局部引入

import axios from ‘axios’ 直接使用axios即可

get

axios({method: ‘get’,url: ‘’,params: {}}).then(res => { })
params是添加到url的请求字符串中的,一般用于get请求中向指定用户请求数据

post

axios({ method: ‘post’,url: ‘’,data: {}}).then(res => { })

delete

axios({method: ‘delete’,url: ‘’,params: {}}).then(res => { do something })

为Echarts图表请求数据

axios请求