vue-resource
安装:npm install vue-resource --save
1、get请求
this.$http.get(url,{params:{key:value}})
.then(
res=>{
//请求成功回调函数
},
err=>{
//请求失败回调函数
}
);
2、post请求
this.$http.post(url,{key:value})
.then(
res=>{
//请求成功回调函数
},
err=>{
//请求失败回调函数
}
);
3、JSONP请求
this.$http.jsonp(url,{params:{key:value}})
.then(
res=>{
//请求成功回调函数
},
err=>{
//请求失败回调函数
}
);
vue-resource用法
最新推荐文章于 2022-06-06 19:58:02 发布