Vue的axios-post的使用/* post方法1 */axios({url: /api/joke/latest,params: {appCode: xxx,pagesize: 10,},methods: post,}).then(res = {console.log(res);console.log(post成功)}).catch(err = {c...

Vue的axios-post的使用
/* post方法1 */
axios({
url: '/api/joke/latest',
params: {
appCode: 'xxx',
pagesize: 10,
},
methods: 'post',
}).then(res => {
console.log(res);
console.log("post成功")
}).catch(err => {
console.log(err);
console.log("post失败");
})
/* post方法2,post的第二个形参写参数
好像这种参数容易暴露在url中的
*/
axios.post('/api/life/tip', {
'appCode': 'xxx'
}).then(res => {
console.log("post成功");
console.log(res);
}).catch(err => {
console.log("post失败");
console.log(err);
});
/*这种传参最好*/
axios.post('/dsd2/life/tip', "appCode=xxx").then(res => {
console.log("post成功");
console.log(res);
}).catch(err => {
console.log("post失败");
console.log(err);
})
织梦狗教程
本文标题为:Vue的axios-post的使用


基础教程推荐
猜你喜欢
- Flutter手势密码的实现示例(附demo) 2023-04-11
- Android中的webview监听每次URL变化实例 2023-01-23
- 解决Android Studio突然不显示logcat日志的问题 2023-02-04
- Android开发使用RecyclerView添加点击事件实例详解 2023-06-15
- IOS应用内跳转系统设置相关界面的方法 2022-11-20
- IOS 播放系统提示音使用总结(AudioToolbox) 2023-03-01
- android studio按钮监听的5种方法实例详解 2023-01-12
- Flutter绘图组件之CustomPaint使用详解 2023-05-12
- Android多返回栈技术 2023-04-15
- iOS开发教程之XLForm的基本使用方法 2023-05-01