Axios-请求方式别名
为了方便起见,Axios已经为所有支持的请求方法提供了别名
格式:axios.请求方式(url [, data [, config]])
axios.get('https://mock.apifox.cn/m1/3083103-0-default/emps/list').then((result) => {//输入代码thenc会提示then catch框架 console.log(result.data); }).catch((err) => { console.log(err); });
axios.post('https://mock.apifox.cn/m1/3083103-0-default/emps/update','id=1').then((result) => {
console.log(result.data);
}).catch((err) => {
console.log(err);
});
GET: axios.get(url).then((res)=>{…}).catch((err)=>{…})
POST: axios.post(url).then((res)=>{…}).catch((err)=>{…})
浙公网安备 33010602011771号